linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/imx: Fix of_node ref counting
@ 2016-09-04  6:45 Christophe JAILLET
  2016-09-05  8:01 ` Philipp Zabel
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2016-09-04  6:45 UTC (permalink / raw)
  To: p.zabel, airlied
  Cc: dri-devel, linux-kernel, kernel-janitors, Christophe JAILLET

This code is spurious.
It takes a ref on a node, then call 'of_node_put' on it and then store
this node somewhere.

It is likely that taking the ref on the parent node and releasing the child
node was expected instead.

So, use 'of_get_next_parent' instead. It does all this in just one
function call.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Un-tested
---
 drivers/gpu/drm/imx/imx-drm-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 438bac8fbc2b..60fb388c80f8 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -449,10 +449,8 @@ static int compare_of(struct device *dev, void *data)
 	}
 
 	/* Special case for LDB, one device for two channels */
-	if (of_node_cmp(np->name, "lvds-channel") == 0) {
-		np = of_get_parent(np);
-		of_node_put(np);
-	}
+	if (of_node_cmp(np->name, "lvds-channel") == 0)
+		np = of_get_next_parent(np);
 
 	return dev->of_node == np;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-05  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-04  6:45 [PATCH] drm/imx: Fix of_node ref counting Christophe JAILLET
2016-09-05  8:01 ` Philipp Zabel
2016-09-05  8:06   ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).