All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] add missing of_node_put
@ 2019-01-13  9:44 ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: devicetree
  Cc: kernel-janitors, linux-kernel, dri-devel, linux-renesas-soc,
	linux-amlogic, linux-arm-kernel

The result of of_graph_get_remote_port_parent needs an of_node_put,
even if it is not available.

---

 drivers/gpu/drm/meson/meson_drv.c     |    9 +++++++--
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 drivers/of/property.c                 |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

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

* [PATCH 0/3] add missing of_node_put
@ 2019-01-13  9:44 ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: devicetree
  Cc: kernel-janitors, linux-kernel, dri-devel, linux-renesas-soc,
	linux-amlogic, linux-arm-kernel

The result of of_graph_get_remote_port_parent needs an of_node_put,
even if it is not available.

---

 drivers/gpu/drm/meson/meson_drv.c     |    9 +++++++--
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 drivers/of/property.c                 |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 0/3] add missing of_node_put
@ 2019-01-13  9:44 ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: devicetree
  Cc: kernel-janitors, linux-kernel, dri-devel, linux-renesas-soc,
	linux-amlogic, linux-arm-kernel

The result of of_graph_get_remote_port_parent needs an of_node_put,
even if it is not available.

---

 drivers/gpu/drm/meson/meson_drv.c     |    9 +++++++--
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 drivers/of/property.c                 |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

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

* [PATCH 0/3] add missing of_node_put
@ 2019-01-13  9:44 ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: devicetree
  Cc: kernel-janitors, linux-kernel, dri-devel, linux-renesas-soc,
	linux-amlogic, linux-arm-kernel

The result of of_graph_get_remote_port_parent needs an of_node_put,
even if it is not available.

---

 drivers/gpu/drm/meson/meson_drv.c     |    9 +++++++--
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 drivers/of/property.c                 |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 0/3] add missing of_node_put
@ 2019-01-13  9:44 ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: devicetree
  Cc: kernel-janitors, linux-kernel, dri-devel, linux-renesas-soc,
	linux-amlogic, linux-arm-kernel

The result of of_graph_get_remote_port_parent needs an of_node_put,
even if it is not available.

---

 drivers/gpu/drm/meson/meson_drv.c     |    9 +++++++--
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 drivers/of/property.c                 |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH 1/3] drm: rcar-du: add missing of_node_put
  2019-01-13  9:44 ` Julia Lawall
  (?)
@ 2019-01-13  9:44   ` Julia Lawall
  -1 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: kernel-janitors, Kieran Bingham, David Airlie, Daniel Vetter,
	dri-devel, linux-renesas-soc, linux-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e == NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 9c7007d..bc3fcb3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
 		dev_dbg(rcdu->dev,
 			"connected entity %pOF is disabled, skipping\n",
 			entity);
+		of_node_put(entity);
 		return -ENODEV;
 	}
 


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

* [PATCH 1/3] drm: rcar-du: add missing of_node_put
@ 2019-01-13  9:44   ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	linux-renesas-soc, Kieran Bingham

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e = NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 9c7007d..bc3fcb3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
 		dev_dbg(rcdu->dev,
 			"connected entity %pOF is disabled, skipping\n",
 			entity);
+		of_node_put(entity);
 		return -ENODEV;
 	}
 

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

* [PATCH 1/3] drm: rcar-du: add missing of_node_put
@ 2019-01-13  9:44   ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	linux-renesas-soc, Kieran Bingham

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e == NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 9c7007d..bc3fcb3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
 		dev_dbg(rcdu->dev,
 			"connected entity %pOF is disabled, skipping\n",
 			entity);
+		of_node_put(entity);
 		return -ENODEV;
 	}
 

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

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

* [PATCH 2/3] OF: properties: add missing of_node_put
  2019-01-13  9:44 ` Julia Lawall
@ 2019-01-13  9:44   ` Julia Lawall
  -1 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Rob Herring; +Cc: kernel-janitors, Frank Rowand, devicetree, linux-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e == NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/of/property.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 0843003..8631efa 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -806,6 +806,7 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node,
 
 	if (!of_device_is_available(remote)) {
 		pr_debug("not available for remote node\n");
+		of_node_put(remote);
 		return NULL;
 	}
 


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

* [PATCH 2/3] OF: properties: add missing of_node_put
@ 2019-01-13  9:44   ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Rob Herring; +Cc: kernel-janitors, Frank Rowand, devicetree, linux-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e = NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/of/property.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 0843003..8631efa 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -806,6 +806,7 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node,
 
 	if (!of_device_is_available(remote)) {
 		pr_debug("not available for remote node\n");
+		of_node_put(remote);
 		return NULL;
 	}
 

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

* [PATCH 3/3] drm/meson: add missing of_node_put
  2019-01-13  9:44 ` Julia Lawall
                     ` (2 preceding siblings ...)
  (?)
@ 2019-01-13  9:44   ` Julia Lawall
  -1 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: kernel-janitors, David Airlie, Daniel Vetter, Kevin Hilman,
	dri-devel, linux-amlogic, linux-arm-kernel, linux-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

An of_node_put is also needed when meson_probe_remote completes.  This was
present at the recursive call, but not in the call from meson_drv_probe.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e == NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 3ee4d4a4e..b59c757 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
 		remote_node = of_graph_get_remote_port_parent(ep);
 		if (!remote_node ||
 		    remote_node == parent || /* Ignore parent endpoint */
-		    !of_device_is_available(remote_node))
+		    !of_device_is_available(remote_node)) {
+			of_node_put(remote_node);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, match, remote, remote_node);
 
@@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
 
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
-		if (!remote || !of_device_is_available(remote))
+		if (!remote || !of_device_is_available(remote)) {
+			of_node_put(remote);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, &match, np, remote);
+		of_node_put(remote);
 	}
 
 	if (count && !match)


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

* [PATCH 3/3] drm/meson: add missing of_node_put
@ 2019-01-13  9:44   ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: David Airlie, Kevin Hilman, kernel-janitors, linux-kernel,
	dri-devel, linux-amlogic, linux-arm-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

An of_node_put is also needed when meson_probe_remote completes.  This was
present at the recursive call, but not in the call from meson_drv_probe.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e = NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 3ee4d4a4e..b59c757 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
 		remote_node = of_graph_get_remote_port_parent(ep);
 		if (!remote_node ||
 		    remote_node = parent || /* Ignore parent endpoint */
-		    !of_device_is_available(remote_node))
+		    !of_device_is_available(remote_node)) {
+			of_node_put(remote_node);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, match, remote, remote_node);
 
@@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
 
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
-		if (!remote || !of_device_is_available(remote))
+		if (!remote || !of_device_is_available(remote)) {
+			of_node_put(remote);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, &match, np, remote);
+		of_node_put(remote);
 	}
 
 	if (count && !match)

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

* [PATCH 3/3] drm/meson: add missing of_node_put
@ 2019-01-13  9:44   ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: David Airlie, Kevin Hilman, kernel-janitors, linux-kernel,
	dri-devel, Daniel Vetter, linux-amlogic, linux-arm-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

An of_node_put is also needed when meson_probe_remote completes.  This was
present at the recursive call, but not in the call from meson_drv_probe.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e == NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 3ee4d4a4e..b59c757 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
 		remote_node = of_graph_get_remote_port_parent(ep);
 		if (!remote_node ||
 		    remote_node == parent || /* Ignore parent endpoint */
-		    !of_device_is_available(remote_node))
+		    !of_device_is_available(remote_node)) {
+			of_node_put(remote_node);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, match, remote, remote_node);
 
@@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
 
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
-		if (!remote || !of_device_is_available(remote))
+		if (!remote || !of_device_is_available(remote)) {
+			of_node_put(remote);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, &match, np, remote);
+		of_node_put(remote);
 	}
 
 	if (count && !match)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/3] drm/meson: add missing of_node_put
@ 2019-01-13  9:44   ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: David Airlie, Kevin Hilman, kernel-janitors, linux-kernel,
	dri-devel, linux-amlogic, linux-arm-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

An of_node_put is also needed when meson_probe_remote completes.  This was
present at the recursive call, but not in the call from meson_drv_probe.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e == NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 3ee4d4a4e..b59c757 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
 		remote_node = of_graph_get_remote_port_parent(ep);
 		if (!remote_node ||
 		    remote_node == parent || /* Ignore parent endpoint */
-		    !of_device_is_available(remote_node))
+		    !of_device_is_available(remote_node)) {
+			of_node_put(remote_node);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, match, remote, remote_node);
 
@@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
 
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
-		if (!remote || !of_device_is_available(remote))
+		if (!remote || !of_device_is_available(remote)) {
+			of_node_put(remote);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, &match, np, remote);
+		of_node_put(remote);
 	}
 
 	if (count && !match)

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

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

* [PATCH 3/3] drm/meson: add missing of_node_put
@ 2019-01-13  9:44   ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-13  9:44 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: David Airlie, Kevin Hilman, kernel-janitors, linux-kernel,
	dri-devel, Daniel Vetter, linux-amlogic, linux-arm-kernel

Add an of_node_put when the result of of_graph_get_remote_port_parent is
not available.

An of_node_put is also needed when meson_probe_remote completes.  This was
present at the recursive call, but not in the call from meson_drv_probe.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
    when != true e == NULL
    when != of_node_put(e)
    when != of_fwnode_handle(e)
(
return e;
|
*return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 3ee4d4a4e..b59c757 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
 		remote_node = of_graph_get_remote_port_parent(ep);
 		if (!remote_node ||
 		    remote_node == parent || /* Ignore parent endpoint */
-		    !of_device_is_available(remote_node))
+		    !of_device_is_available(remote_node)) {
+			of_node_put(remote_node);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, match, remote, remote_node);
 
@@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
 
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
-		if (!remote || !of_device_is_available(remote))
+		if (!remote || !of_device_is_available(remote)) {
+			of_node_put(remote);
 			continue;
+		}
 
 		count += meson_probe_remote(pdev, &match, np, remote);
+		of_node_put(remote);
 	}
 
 	if (count && !match)


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 1/3] drm: rcar-du: add missing of_node_put
  2019-01-13  9:44   ` Julia Lawall
  (?)
@ 2019-01-14 14:34     ` Kieran Bingham
  -1 siblings, 0 replies; 27+ messages in thread
From: Kieran Bingham @ 2019-01-14 14:34 UTC (permalink / raw)
  To: Julia Lawall, Laurent Pinchart
  Cc: kernel-janitors, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Julia,

Thank you for the patch,

On 13/01/2019 09:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e == NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
> 

For this part at least:

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

But a little discussion below:


> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

This does indeed look like a missing of_node_put() but I don't think it
will be the only one in that code. It gets a bit tangled - and I think
there's possibly another missing put on the error path of

        if (!encoder) {
                dev_warn(rcdu->dev,
                         "no encoder found for endpoint %pOF, skipping\n",
                         ep->local_node);
                return -ENODEV;
        }

because that implies that no encoder was found, and thus -
                encoder = entity;

was not executed, and the tail of that function calls:

         of_node_put(encoder);

which would have been the final of_node_put(entity)


I think that part could be considered separate to this patch, but it's
also quite closely related. Either way - I think it needs a second pair
of eyes to see if I'm not crazy :)

Regards

Kieran

> 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index 9c7007d..bc3fcb3 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
>  		dev_dbg(rcdu->dev,
>  			"connected entity %pOF is disabled, skipping\n",
>  			entity);
> +		of_node_put(entity);
>  		return -ENODEV;
>  	}
>  
> 


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

* Re: [PATCH 1/3] drm: rcar-du: add missing of_node_put
@ 2019-01-14 14:34     ` Kieran Bingham
  0 siblings, 0 replies; 27+ messages in thread
From: Kieran Bingham @ 2019-01-14 14:34 UTC (permalink / raw)
  To: Julia Lawall, Laurent Pinchart
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	linux-renesas-soc

Hi Julia,

Thank you for the patch,

On 13/01/2019 09:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e = NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
> 

For this part at least:

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

But a little discussion below:


> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

This does indeed look like a missing of_node_put() but I don't think it
will be the only one in that code. It gets a bit tangled - and I think
there's possibly another missing put on the error path of

        if (!encoder) {
                dev_warn(rcdu->dev,
                         "no encoder found for endpoint %pOF, skipping\n",
                         ep->local_node);
                return -ENODEV;
        }

because that implies that no encoder was found, and thus -
                encoder = entity;

was not executed, and the tail of that function calls:

         of_node_put(encoder);

which would have been the final of_node_put(entity)


I think that part could be considered separate to this patch, but it's
also quite closely related. Either way - I think it needs a second pair
of eyes to see if I'm not crazy :)

Regards

Kieran

> 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index 9c7007d..bc3fcb3 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
>  		dev_dbg(rcdu->dev,
>  			"connected entity %pOF is disabled, skipping\n",
>  			entity);
> +		of_node_put(entity);
>  		return -ENODEV;
>  	}
>  
> 

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

* Re: [PATCH 1/3] drm: rcar-du: add missing of_node_put
@ 2019-01-14 14:34     ` Kieran Bingham
  0 siblings, 0 replies; 27+ messages in thread
From: Kieran Bingham @ 2019-01-14 14:34 UTC (permalink / raw)
  To: Julia Lawall, Laurent Pinchart
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	linux-renesas-soc

Hi Julia,

Thank you for the patch,

On 13/01/2019 09:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e == NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
> 

For this part at least:

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

But a little discussion below:


> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

This does indeed look like a missing of_node_put() but I don't think it
will be the only one in that code. It gets a bit tangled - and I think
there's possibly another missing put on the error path of

        if (!encoder) {
                dev_warn(rcdu->dev,
                         "no encoder found for endpoint %pOF, skipping\n",
                         ep->local_node);
                return -ENODEV;
        }

because that implies that no encoder was found, and thus -
                encoder = entity;

was not executed, and the tail of that function calls:

         of_node_put(encoder);

which would have been the final of_node_put(entity)


I think that part could be considered separate to this patch, but it's
also quite closely related. Either way - I think it needs a second pair
of eyes to see if I'm not crazy :)

Regards

Kieran

> 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index 9c7007d..bc3fcb3 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
>  		dev_dbg(rcdu->dev,
>  			"connected entity %pOF is disabled, skipping\n",
>  			entity);
> +		of_node_put(entity);
>  		return -ENODEV;
>  	}
>  
> 

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

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

* Re: [PATCH 3/3] drm/meson: add missing of_node_put
  2019-01-13  9:44   ` Julia Lawall
  (?)
  (?)
@ 2019-01-14 15:32     ` Neil Armstrong
  -1 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2019-01-14 15:32 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, David Airlie, Daniel Vetter, Kevin Hilman,
	dri-devel, linux-amlogic, linux-arm-kernel, linux-kernel

Hi Julia,

On 13/01/2019 10:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
> 
> An of_node_put is also needed when meson_probe_remote completes.  This was
> present at the recursive call, but not in the call from meson_drv_probe.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e == NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

And applied to drm-misc-fixes.

Neil

> 
> ---
>  drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 3ee4d4a4e..b59c757 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
>  		remote_node = of_graph_get_remote_port_parent(ep);
>  		if (!remote_node ||
>  		    remote_node == parent || /* Ignore parent endpoint */
> -		    !of_device_is_available(remote_node))
> +		    !of_device_is_available(remote_node)) {
> +			of_node_put(remote_node);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, match, remote, remote_node);
>  
> @@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
>  
>  	for_each_endpoint_of_node(np, ep) {
>  		remote = of_graph_get_remote_port_parent(ep);
> -		if (!remote || !of_device_is_available(remote))
> +		if (!remote || !of_device_is_available(remote)) {
> +			of_node_put(remote);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, &match, np, remote);
> +		of_node_put(remote);
>  	}
>  
>  	if (count && !match)
> 


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

* Re: [PATCH 3/3] drm/meson: add missing of_node_put
@ 2019-01-14 15:32     ` Neil Armstrong
  0 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2019-01-14 15:32 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, David Airlie, Daniel Vetter, Kevin Hilman,
	dri-devel, linux-amlogic, linux-arm-kernel, linux-kernel

Hi Julia,

On 13/01/2019 10:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
> 
> An of_node_put is also needed when meson_probe_remote completes.  This was
> present at the recursive call, but not in the call from meson_drv_probe.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e = NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

And applied to drm-misc-fixes.

Neil

> 
> ---
>  drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 3ee4d4a4e..b59c757 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
>  		remote_node = of_graph_get_remote_port_parent(ep);
>  		if (!remote_node ||
>  		    remote_node = parent || /* Ignore parent endpoint */
> -		    !of_device_is_available(remote_node))
> +		    !of_device_is_available(remote_node)) {
> +			of_node_put(remote_node);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, match, remote, remote_node);
>  
> @@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
>  
>  	for_each_endpoint_of_node(np, ep) {
>  		remote = of_graph_get_remote_port_parent(ep);
> -		if (!remote || !of_device_is_available(remote))
> +		if (!remote || !of_device_is_available(remote)) {
> +			of_node_put(remote);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, &match, np, remote);
> +		of_node_put(remote);
>  	}
>  
>  	if (count && !match)
> 

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

* Re: [PATCH 3/3] drm/meson: add missing of_node_put
@ 2019-01-14 15:32     ` Neil Armstrong
  0 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2019-01-14 15:32 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Airlie, Kevin Hilman, kernel-janitors, linux-kernel,
	dri-devel, Daniel Vetter, linux-amlogic, linux-arm-kernel

Hi Julia,

On 13/01/2019 10:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
> 
> An of_node_put is also needed when meson_probe_remote completes.  This was
> present at the recursive call, but not in the call from meson_drv_probe.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e == NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

And applied to drm-misc-fixes.

Neil

> 
> ---
>  drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 3ee4d4a4e..b59c757 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
>  		remote_node = of_graph_get_remote_port_parent(ep);
>  		if (!remote_node ||
>  		    remote_node == parent || /* Ignore parent endpoint */
> -		    !of_device_is_available(remote_node))
> +		    !of_device_is_available(remote_node)) {
> +			of_node_put(remote_node);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, match, remote, remote_node);
>  
> @@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
>  
>  	for_each_endpoint_of_node(np, ep) {
>  		remote = of_graph_get_remote_port_parent(ep);
> -		if (!remote || !of_device_is_available(remote))
> +		if (!remote || !of_device_is_available(remote)) {
> +			of_node_put(remote);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, &match, np, remote);
> +		of_node_put(remote);
>  	}
>  
>  	if (count && !match)
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] drm/meson: add missing of_node_put
@ 2019-01-14 15:32     ` Neil Armstrong
  0 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2019-01-14 15:32 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Airlie, Kevin Hilman, kernel-janitors, linux-kernel,
	dri-devel, Daniel Vetter, linux-amlogic, linux-arm-kernel

Hi Julia,

On 13/01/2019 10:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
> 
> An of_node_put is also needed when meson_probe_remote completes.  This was
> present at the recursive call, but not in the call from meson_drv_probe.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e == NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

And applied to drm-misc-fixes.

Neil

> 
> ---
>  drivers/gpu/drm/meson/meson_drv.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 3ee4d4a4e..b59c757 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
>  		remote_node = of_graph_get_remote_port_parent(ep);
>  		if (!remote_node ||
>  		    remote_node == parent || /* Ignore parent endpoint */
> -		    !of_device_is_available(remote_node))
> +		    !of_device_is_available(remote_node)) {
> +			of_node_put(remote_node);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, match, remote, remote_node);
>  
> @@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
>  
>  	for_each_endpoint_of_node(np, ep) {
>  		remote = of_graph_get_remote_port_parent(ep);
> -		if (!remote || !of_device_is_available(remote))
> +		if (!remote || !of_device_is_available(remote)) {
> +			of_node_put(remote);
>  			continue;
> +		}
>  
>  		count += meson_probe_remote(pdev, &match, np, remote);
> +		of_node_put(remote);
>  	}
>  
>  	if (count && !match)
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 1/3] drm: rcar-du: add missing of_node_put
  2019-01-14 14:34     ` Kieran Bingham
  (?)
@ 2019-01-14 16:19       ` Julia Lawall
  -1 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-14 16:19 UTC (permalink / raw)
  To: Kieran Bingham
  Cc: Laurent Pinchart, kernel-janitors, David Airlie, Daniel Vetter,
	dri-devel, linux-renesas-soc, linux-kernel



On Mon, 14 Jan 2019, Kieran Bingham wrote:

> Hi Julia,
>
> Thank you for the patch,
>
> On 13/01/2019 09:44, Julia Lawall wrote:
> > Add an of_node_put when the result of of_graph_get_remote_port_parent is
> > not available.
> >
> > The semantic match that finds this problem is as follows
> > (http://coccinelle.lip6.fr):
> >
> > // <smpl>
> > @r exists@
> > local idexpression e;
> > expression x;
> > @@
> > e = of_graph_get_remote_port_parent(...);
> > ... when != x = e
> >     when != true e == NULL
> >     when != of_node_put(e)
> >     when != of_fwnode_handle(e)
> > (
> > return e;
> > |
> > *return ...;
> > )
> > // </smpl>
> >
>
> For this part at least:
>
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>
> But a little discussion below:
>
>
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> This does indeed look like a missing of_node_put() but I don't think it
> will be the only one in that code. It gets a bit tangled - and I think
> there's possibly another missing put on the error path of
>
>         if (!encoder) {
>                 dev_warn(rcdu->dev,
>                          "no encoder found for endpoint %pOF, skipping\n",
>                          ep->local_node);
>                 return -ENODEV;
>         }
>
> because that implies that no encoder was found, and thus -
>                 encoder = entity;
>
> was not executed, and the tail of that function calls:
>
>          of_node_put(encoder);
>
> which would have been the final of_node_put(entity)

Looking at it again, I agree.  I can just extend this patch.

julia


>
>
> I think that part could be considered separate to this patch, but it's
> also quite closely related. Either way - I think it needs a second pair
> of eyes to see if I'm not crazy :)
>
> Regards
>
> Kieran
>
> >
> > ---
> >  drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > index 9c7007d..bc3fcb3 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > @@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
> >  		dev_dbg(rcdu->dev,
> >  			"connected entity %pOF is disabled, skipping\n",
> >  			entity);
> > +		of_node_put(entity);
> >  		return -ENODEV;
> >  	}
> >
> >
>
>

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

* Re: [PATCH 1/3] drm: rcar-du: add missing of_node_put
@ 2019-01-14 16:19       ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-14 16:19 UTC (permalink / raw)
  To: Kieran Bingham
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	linux-renesas-soc, Laurent Pinchart



On Mon, 14 Jan 2019, Kieran Bingham wrote:

> Hi Julia,
>
> Thank you for the patch,
>
> On 13/01/2019 09:44, Julia Lawall wrote:
> > Add an of_node_put when the result of of_graph_get_remote_port_parent is
> > not available.
> >
> > The semantic match that finds this problem is as follows
> > (http://coccinelle.lip6.fr):
> >
> > // <smpl>
> > @r exists@
> > local idexpression e;
> > expression x;
> > @@
> > e = of_graph_get_remote_port_parent(...);
> > ... when != x = e
> >     when != true e = NULL
> >     when != of_node_put(e)
> >     when != of_fwnode_handle(e)
> > (
> > return e;
> > |
> > *return ...;
> > )
> > // </smpl>
> >
>
> For this part at least:
>
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>
> But a little discussion below:
>
>
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> This does indeed look like a missing of_node_put() but I don't think it
> will be the only one in that code. It gets a bit tangled - and I think
> there's possibly another missing put on the error path of
>
>         if (!encoder) {
>                 dev_warn(rcdu->dev,
>                          "no encoder found for endpoint %pOF, skipping\n",
>                          ep->local_node);
>                 return -ENODEV;
>         }
>
> because that implies that no encoder was found, and thus -
>                 encoder = entity;
>
> was not executed, and the tail of that function calls:
>
>          of_node_put(encoder);
>
> which would have been the final of_node_put(entity)

Looking at it again, I agree.  I can just extend this patch.

julia


>
>
> I think that part could be considered separate to this patch, but it's
> also quite closely related. Either way - I think it needs a second pair
> of eyes to see if I'm not crazy :)
>
> Regards
>
> Kieran
>
> >
> > ---
> >  drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > index 9c7007d..bc3fcb3 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > @@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
> >  		dev_dbg(rcdu->dev,
> >  			"connected entity %pOF is disabled, skipping\n",
> >  			entity);
> > +		of_node_put(entity);
> >  		return -ENODEV;
> >  	}
> >
> >
>
>

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

* Re: [PATCH 1/3] drm: rcar-du: add missing of_node_put
@ 2019-01-14 16:19       ` Julia Lawall
  0 siblings, 0 replies; 27+ messages in thread
From: Julia Lawall @ 2019-01-14 16:19 UTC (permalink / raw)
  To: Kieran Bingham
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	linux-renesas-soc, Laurent Pinchart



On Mon, 14 Jan 2019, Kieran Bingham wrote:

> Hi Julia,
>
> Thank you for the patch,
>
> On 13/01/2019 09:44, Julia Lawall wrote:
> > Add an of_node_put when the result of of_graph_get_remote_port_parent is
> > not available.
> >
> > The semantic match that finds this problem is as follows
> > (http://coccinelle.lip6.fr):
> >
> > // <smpl>
> > @r exists@
> > local idexpression e;
> > expression x;
> > @@
> > e = of_graph_get_remote_port_parent(...);
> > ... when != x = e
> >     when != true e == NULL
> >     when != of_node_put(e)
> >     when != of_fwnode_handle(e)
> > (
> > return e;
> > |
> > *return ...;
> > )
> > // </smpl>
> >
>
> For this part at least:
>
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>
> But a little discussion below:
>
>
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> This does indeed look like a missing of_node_put() but I don't think it
> will be the only one in that code. It gets a bit tangled - and I think
> there's possibly another missing put on the error path of
>
>         if (!encoder) {
>                 dev_warn(rcdu->dev,
>                          "no encoder found for endpoint %pOF, skipping\n",
>                          ep->local_node);
>                 return -ENODEV;
>         }
>
> because that implies that no encoder was found, and thus -
>                 encoder = entity;
>
> was not executed, and the tail of that function calls:
>
>          of_node_put(encoder);
>
> which would have been the final of_node_put(entity)

Looking at it again, I agree.  I can just extend this patch.

julia


>
>
> I think that part could be considered separate to this patch, but it's
> also quite closely related. Either way - I think it needs a second pair
> of eyes to see if I'm not crazy :)
>
> Regards
>
> Kieran
>
> >
> > ---
> >  drivers/gpu/drm/rcar-du/rcar_du_kms.c |    1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > index 9c7007d..bc3fcb3 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > @@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
> >  		dev_dbg(rcdu->dev,
> >  			"connected entity %pOF is disabled, skipping\n",
> >  			entity);
> > +		of_node_put(entity);
> >  		return -ENODEV;
> >  	}
> >
> >
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 2/3] OF: properties: add missing of_node_put
  2019-01-13  9:44   ` Julia Lawall
@ 2019-01-16 19:03     ` Rob Herring
  -1 siblings, 0 replies; 27+ messages in thread
From: Rob Herring @ 2019-01-16 19:03 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Frank Rowand, devicetree, linux-kernel

On Sun, Jan 13, 2019 at 4:21 AM Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
>
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
>
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e == NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>  drivers/of/property.c |    1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

Rob

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

* Re: [PATCH 2/3] OF: properties: add missing of_node_put
@ 2019-01-16 19:03     ` Rob Herring
  0 siblings, 0 replies; 27+ messages in thread
From: Rob Herring @ 2019-01-16 19:03 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Frank Rowand, devicetree, linux-kernel

On Sun, Jan 13, 2019 at 4:21 AM Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
>
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
>
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
>     when != true e = NULL
>     when != of_node_put(e)
>     when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>  drivers/of/property.c |    1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

Rob

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

end of thread, other threads:[~2019-01-16 19:03 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13  9:44 [PATCH 0/3] add missing of_node_put Julia Lawall
2019-01-13  9:44 ` Julia Lawall
2019-01-13  9:44 ` Julia Lawall
2019-01-13  9:44 ` Julia Lawall
2019-01-13  9:44 ` Julia Lawall
2019-01-13  9:44 ` [PATCH 1/3] drm: rcar-du: " Julia Lawall
2019-01-13  9:44   ` Julia Lawall
2019-01-13  9:44   ` Julia Lawall
2019-01-14 14:34   ` Kieran Bingham
2019-01-14 14:34     ` Kieran Bingham
2019-01-14 14:34     ` Kieran Bingham
2019-01-14 16:19     ` Julia Lawall
2019-01-14 16:19       ` Julia Lawall
2019-01-14 16:19       ` Julia Lawall
2019-01-13  9:44 ` [PATCH 2/3] OF: properties: " Julia Lawall
2019-01-13  9:44   ` Julia Lawall
2019-01-16 19:03   ` Rob Herring
2019-01-16 19:03     ` Rob Herring
2019-01-13  9:44 ` [PATCH 3/3] drm/meson: " Julia Lawall
2019-01-13  9:44   ` Julia Lawall
2019-01-13  9:44   ` Julia Lawall
2019-01-13  9:44   ` Julia Lawall
2019-01-13  9:44   ` Julia Lawall
2019-01-14 15:32   ` Neil Armstrong
2019-01-14 15:32     ` Neil Armstrong
2019-01-14 15:32     ` Neil Armstrong
2019-01-14 15:32     ` Neil Armstrong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.