* [PATCH -next v2] drm/nouveau: Use for_each_child_of_node_scoped()
@ 2024-08-30 7:36 Jinjie Ruan
2024-08-30 22:26 ` Danilo Krummrich
0 siblings, 1 reply; 2+ messages in thread
From: Jinjie Ruan @ 2024-08-30 7:36 UTC (permalink / raw)
To: kherbst, lyude, dakr, airlied, daniel, dri-devel, nouveau, linux-kernel
Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
v2:
- Split out from the patch set.
---
drivers/gpu/drm/nouveau/nouveau_connector.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index b06aa473102b..8d5c9c74cbb9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -477,14 +477,14 @@ nouveau_connector_of_detect(struct drm_connector *connector)
struct nouveau_connector *nv_connector = nouveau_connector(connector);
struct nouveau_encoder *nv_encoder;
struct pci_dev *pdev = to_pci_dev(dev->dev);
- struct device_node *cn, *dn = pci_device_to_OF_node(pdev);
+ struct device_node *dn = pci_device_to_OF_node(pdev);
if (!dn ||
!((nv_encoder = find_encoder(connector, DCB_OUTPUT_TMDS)) ||
(nv_encoder = find_encoder(connector, DCB_OUTPUT_ANALOG))))
return NULL;
- for_each_child_of_node(dn, cn) {
+ for_each_child_of_node_scoped(dn, cn) {
const char *name = of_get_property(cn, "name", NULL);
const void *edid = of_get_property(cn, "EDID", NULL);
int idx = name ? name[strlen(name) - 1] - 'A' : 0;
@@ -492,7 +492,6 @@ nouveau_connector_of_detect(struct drm_connector *connector)
if (nv_encoder->dcb->i2c_index == idx && edid) {
nv_connector->edid =
kmemdup(edid, EDID_LENGTH, GFP_KERNEL);
- of_node_put(cn);
return nv_encoder;
}
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH -next v2] drm/nouveau: Use for_each_child_of_node_scoped()
2024-08-30 7:36 [PATCH -next v2] drm/nouveau: Use for_each_child_of_node_scoped() Jinjie Ruan
@ 2024-08-30 22:26 ` Danilo Krummrich
0 siblings, 0 replies; 2+ messages in thread
From: Danilo Krummrich @ 2024-08-30 22:26 UTC (permalink / raw)
To: Jinjie Ruan
Cc: kherbst, lyude, airlied, daniel, dri-devel, nouveau, linux-kernel
On Fri, Aug 30, 2024 at 03:36:54PM +0800, Jinjie Ruan wrote:
> Avoids the need for manual cleanup of_node_put() in early exits
> from the loop.
>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Applied to drm-misc-next, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-30 22:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-30 7:36 [PATCH -next v2] drm/nouveau: Use for_each_child_of_node_scoped() Jinjie Ruan
2024-08-30 22:26 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®