[PATCH] drm/imx: Fix of_node ref counting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux