Skip to contentSkip to conversation

gpu: drm: not merged missing of_node_put fix

PATCH RESEND Applied Peter Chen 4 participants 9 messages Jul 15, 2016 – Aug 11, 2016

Subsystems (5)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

cover gpu: drm: not merged missing of_node_put fix

Hi Daniel,

Below are the remaining fixes for missing of_node_put, which are not applied by you or individual driver maintainers.

Peter Chen (4):
gpu: drm: omapdrm: connector-dvi: add missing of_node_put after
calling of_parse_phandle
gpu: drm: omapdrm: dss-of: add missing of_node_put after calling
of_parse_phandle
gpu: drm: exynos_hdmi: add missing of_node_put after calling
of_parse_phandle
gpu: drm: arcpgu_drv: add missing of_node_put after calling
of_parse_phandle

 drivers/gpu/drm/arc/arcpgu_drv.c                 | 1 +
 drivers/gpu/drm/exynos/exynos_hdmi.c             | 2 ++
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 1 +
 drivers/gpu/drm/omapdrm/dss/dss-of.c             | 7 ++++---
 4 files changed, 8 insertions(+), 3 deletions(-)
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

PATCH RESEND 1/4 gpu: drm: omapdrm: connector-dvi: add missing of_node_put after calling of_parse_phandle

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/omapdrm/displays/connector-dvi.c +1 -0
index 75f7827..684b7ae 100644
@@ -255,6 +255,7 @@ static int dvic_probe_of(struct platform_device *pdev)
 	adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0);
 	if (adapter_node) {
 		adapter = of_get_i2c_adapter_by_node(adapter_node);
+		of_node_put(adapter_node);
 		if (adapter == NULL) {
 			dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n");
 			omap_dss_put_device(ddata->in);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw

PATCH RESEND 2/4 gpu: drm: omapdrm: dss-of: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/omapdrm/dss/dss-of.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss-of.c +4 -3
index dfd4e96..e256d87 100644
@@ -125,15 +125,16 @@ u32 dss_of_port_get_port_number(struct device_node *port)
 
 static struct device_node *omapdss_of_get_remote_port(const struct device_node *node)
 {
-	struct device_node *np;
+	struct device_node *np, *np_parent;
 
 	np = of_parse_phandle(node, "remote-endpoint", 0);
 	if (!np)
 		return NULL;
 
-	np = of_get_next_parent(np);
+	np_parent = of_get_next_parent(np);
+	of_node_put(np);
 
-	return np;
+	return np_parent;
 }
 
 struct device_node *
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [RESEND Patch 2/4] gpu: drm: omapdrm: dss-of: add missing of_node_put after calling of_parse_phandle

Hi,

Quoted 21 lines · Peter Chen

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/omapdrm/dss/dss-of.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss-of.c +1 -1
index dfd4e96..e256d87 100644
@@ -125,15 +125,16 @@ u32 dss_of_port_get_port_number(struct device_node *port)
 
 static struct device_node *omapdss_of_get_remote_port(const struct device_node *node)
 {
-	struct device_node *np;
+	struct device_node *np, *np_parent;
 
 	np = of_parse_phandle(node, "remote-endpoint", 0);

drivers/gpu/drm/omapdrm/dss/dss-of.c u32 dss_of_port_get_port_number(struct device_node *port) · line 138

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/dss-of.c +3 -2
 	if (!np)
 		return NULL;
 
-	np = of_get_next_parent(np);
+	np_parent = of_get_next_parent(np);
+	of_node_put(np);
 
-	return np;
+	return np_parent;
 }

The doc for of_get_next_parent() says:

"This is like of_get_parent() except that it drops the refcount on the passed node, making it suitable for iterating".

So this patch breaks omapdrm.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#4 lore raw

RE: [RESEND Patch 2/4] gpu: drm: omapdrm: dss-of: add missing of_node_put after calling of_parse_phandle

Quoted 33 lines · Peter Chen
Quoted 30 lines

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/omapdrm/dss/dss-of.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss-of.c +3 -2
index dfd4e96..e256d87 100644
@@ -125,15 +125,16 @@ u32 dss_of_port_get_port_number(struct
 device_node *port)
 
 static struct device_node *omapdss_of_get_remote_port(const struct
 device_node *node)  {
-	struct device_node *np;
+	struct device_node *np, *np_parent;
 
 	np = of_parse_phandle(node, "remote-endpoint", 0);
 	if (!np)
 		return NULL;
 
-	np = of_get_next_parent(np);
+	np_parent = of_get_next_parent(np);
+	of_node_put(np);
 
Quoted 9 lines

drivers/gpu/drm/omapdrm/dss/dss-of.c u32 dss_of_port_get_port_number(struct device_node *port) · line 138

Quoted 3 lines
drivers/gpu/drm/omapdrm/dss/dss-of.c +1 -1
-	return np;
+	return np_parent;
 }

The doc for of_get_next_parent() says:

"This is like of_get_parent() except that it drops the refcount on the passed node, making it suitable for iterating".

It is my careless, thanks for pointing it.

Peter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [RESEND Patch 2/4] gpu: drm: omapdrm: dss-of: add missing of_node_put after calling of_parse_phandle

Quoted 39 lines · Peter Chen
Quoted 39 lines · Peter Chen
Quoted 23 lines

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/omapdrm/dss/dss-of.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss-of.c +1 -1
index dfd4e96..e256d87 100644
@@ -125,15 +125,16 @@ u32 dss_of_port_get_port_number(struct
 device_node *port)
 
 static struct device_node *omapdss_of_get_remote_port(const struct
 device_node *node)  {
-	struct device_node *np;
+	struct device_node *np, *np_parent;
 
 	np = of_parse_phandle(node, "remote-endpoint", 0);

drivers/gpu/drm/omapdrm/dss/dss-of.c u32 dss_of_port_get_port_number(struct · line 139

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/dss-of.c +3 -2
 	if (!np)
 		return NULL;
 
-	np = of_get_next_parent(np);
+	np_parent = of_get_next_parent(np);
+	of_node_put(np);
 
-	return np;
+	return np_parent;
 }

The doc for of_get_next_parent() says:

Quoted 5 lines
Quoted 3 lines

"This is like of_get_parent() except that it drops the refcount on the passed node, making it suitable for iterating".

It is my careless, thanks for pointing it.

Since it's already replied, should we just revert, or is a fixup patch better?
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#6 lore raw

PATCH RESEND 3/4 gpu: drm: exynos_hdmi: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Joonyoung Shim <[email protected]>
Cc Seung-Woo Kim <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -0
index 1625d7c..2275efe 100644
@@ -1820,6 +1820,7 @@ static int hdmi_probe(struct platform_device *pdev)
 		DRM_ERROR("Failed to find ddc node in device tree\n");
 		return -ENODEV;
 	}
+	of_node_put(dev->of_node);
 
 out_get_ddc_adpt:
 	hdata->ddc_adpt = of_find_i2c_adapter_by_node(ddc_node);
@@ -1838,6 +1839,7 @@ out_get_ddc_adpt:
 		ret = -ENODEV;
 		goto err_ddc;
 	}
+	of_node_put(dev->of_node);
 
 out_get_phy_port:
 	if (hdata->drv_data->is_apb_phy) {
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#7 lore raw

PATCH RESEND 4/4 gpu: drm: arcpgu_drv: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Alexey Brodkin <[email protected]>
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/arc/arcpgu_drv.c +1 -0
index ccbdadb..0226ec0 100644
@@ -127,6 +127,7 @@ static int arcpgu_load(struct drm_device *drm)
 	encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0);
 	if (encoder_node) {
 		ret = arcpgu_drm_hdmi_init(drm, encoder_node);
+		of_node_put(encoder_node);
 		if (ret < 0)
 			return ret;
 	} else {
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Applied
#8 lore raw
In reply to Peter Chen
Quoted 15 lines · Peter Chen

Hi Daniel,

Below are the remaining fixes for missing of_node_put, which are not applied by you or individual driver maintainers.

Peter Chen (4):
gpu: drm: omapdrm: connector-dvi: add missing of_node_put after
calling of_parse_phandle
gpu: drm: omapdrm: dss-of: add missing of_node_put after calling
of_parse_phandle
gpu: drm: exynos_hdmi: add missing of_node_put after calling
of_parse_phandle
gpu: drm: arcpgu_drv: add missing of_node_put after calling
of_parse_phandle

Quoted 5 lines
 drivers/gpu/drm/arc/arcpgu_drv.c                 | 1 +
 drivers/gpu/drm/exynos/exynos_hdmi.c             | 2 ++
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 1 +
 drivers/gpu/drm/omapdrm/dss/dss-of.c             | 7 ++++---
 4 files changed, 8 insertions(+), 3 deletions(-)

Applied to drm-misc.

Quoted 8 lines

--
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel