Skip to contentSkip to conversation

gpu: drm: remaining missing of_node_put issue fixes

PATCH Applied Peter Chen 5 participants 16 messages Jul 5, 2016 – Jul 12, 2016

Subsystems (8)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

cover gpu: drm: remaining missing of_node_put issue fixes

Hi David,

This is remaining missing of_node_put issue fix for gpu/drm drivers, the other fixes I sent yesterday. I think it may be easier for reviewing using patch set for similar issue, thanks.

Peter Chen (7):
gpu: drm: rockchip_drm_drv: add missing of_node_put after calling
of_parse_phandle
gpu: drm: sti_compositor: add missing of_node_put after calling
of_parse_phandle
gpu: drm: sti_vdo: add missing of_node_put after calling
of_parse_phandle
gpu: drm: sti_hqvdp: add missing of_node_put after calling
of_parse_phandle
gpu: drm: sti_vtg: add missing of_node_put after calling
of_parse_phandle
gpu: drm: sun4i_drv: add missing of_node_put after calling
of_parse_phandle
gpu: drm: vc4_hdmi: add missing of_node_put after calling
of_parse_phandle

 drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  1 +
 drivers/gpu/drm/sti/sti_compositor.c        |  2 ++
 drivers/gpu/drm/sti/sti_dvo.c               |  1 +
 drivers/gpu/drm/sti/sti_hqvdp.c             |  1 +
 drivers/gpu/drm/sti/sti_vtg.c               |  1 +
 drivers/gpu/drm/sun4i/sun4i_drv.c           |  1 +
 drivers/gpu/drm/vc4/vc4_hdmi.c              | 13 +++++++------
 7 files changed, 14 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/7 gpu: drm: rockchip_drm_drv: 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 Mark Yao <[email protected]>
Cc Heiko Stuebner <[email protected]>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
index a409d1f..935c5e0 100644
@@ -518,6 +518,7 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev)
 			is_support_iommu = false;
 		}
 
+		of_node_put(iommu);
 		component_match_add(dev, &match, compare_of, port->parent);
 		of_node_put(port);
 	}
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/7 gpu: drm: sti_compositor: 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 Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_compositor.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/sti/sti_compositor.c +2 -0
index 3d2fa3a..064de14 100644
@@ -247,10 +247,12 @@ static int sti_compositor_probe(struct platform_device *pdev)
 	vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0);
 	if (vtg_np)
 		compo->vtg_main = of_vtg_find(vtg_np);
+	of_node_put(vtg_np);
 
 	vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 1);
 	if (vtg_np)
 		compo->vtg_aux = of_vtg_find(vtg_np);
+	of_node_put(vtg_np);
 
 	platform_set_drvdata(pdev, compo);
 
Signature · 1 line
1.9.1
Acked-by on v1 2/7
#3 lore raw

Re: [PATCH 2/7] gpu: drm: sti_compositor: add missing of_node_put after calling of_parse_phandle

2016-07-05 4:04 GMT+02:00 Peter Chen <[email protected]>:

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 Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_compositor.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/sti/sti_compositor.c +2 -1
index 3d2fa3a..064de14 100644
@@ -247,10 +247,12 @@ static int sti_compositor_probe(struct platform_device *pdev)
        vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0);
        if (vtg_np)
                compo->vtg_main = of_vtg_find(vtg_np);
+       of_node_put(vtg_np);
 
        vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 1);
        if (vtg_np)
                compo->vtg_aux = of_vtg_find(vtg_np);
+       of_node_put(vtg_np);
 
        platform_set_drvdata(pdev, compo);
 
--

1.9.1

Signature · 11 lines
Benjamin Gaignard

Graphic Working Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#4 lore raw

PATCH 3/7 gpu: drm: sti_vdo: 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 Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_dvo.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/sti/sti_dvo.c +1 -0
index 25f7663..7e211a8 100644
@@ -602,6 +602,7 @@ static int sti_dvo_probe(struct platform_device *pdev)
 	dvo->panel_node = of_parse_phandle(np, "sti,panel", 0);
 	if (!dvo->panel_node)
 		DRM_ERROR("No panel associated to the dvo output\n");
+	of_node_put(dvo->panel_node);
 
 	platform_set_drvdata(pdev, dvo);
 
Signature · 1 line
1.9.1
Acked-by on v1 3/7
#5 lore raw

Re: [PATCH 3/7] gpu: drm: sti_vdo: add missing of_node_put after calling of_parse_phandle

2016-07-05 4:04 GMT+02:00 Peter Chen <[email protected]>:

Quoted 25 lines

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

Cc Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_dvo.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/sti/sti_dvo.c +1 -1
index 25f7663..7e211a8 100644
@@ -602,6 +602,7 @@ static int sti_dvo_probe(struct platform_device *pdev)
        dvo->panel_node = of_parse_phandle(np, "sti,panel", 0);
        if (!dvo->panel_node)
                DRM_ERROR("No panel associated to the dvo output\n");
+       of_node_put(dvo->panel_node);
 
        platform_set_drvdata(pdev, dvo);
 
--

1.9.1

Signature · 11 lines
Benjamin Gaignard

Graphic Working Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#6 lore raw

PATCH 4/7 gpu: drm: sti_hqvdp: 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 Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/sti/sti_hqvdp.c +1 -0
index 1edec29..4f052fa 100644
@@ -1346,6 +1346,7 @@ static int sti_hqvdp_probe(struct platform_device *pdev)
 	vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0);
 	if (vtg_np)
 		hqvdp->vtg = of_vtg_find(vtg_np);
+	of_node_put(vtg_np);
 
 	platform_set_drvdata(pdev, hqvdp);
 
Signature · 1 line
1.9.1
Acked-by on v1 4/7
#7 lore raw

Re: [PATCH 4/7] gpu: drm: sti_hqvdp: add missing of_node_put after calling of_parse_phandle

2016-07-05 4:04 GMT+02:00 Peter Chen <[email protected]>:

Quoted 25 lines

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

Cc Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/sti/sti_hqvdp.c +1 -1
index 1edec29..4f052fa 100644
@@ -1346,6 +1346,7 @@ static int sti_hqvdp_probe(struct platform_device *pdev)
        vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0);
        if (vtg_np)
                hqvdp->vtg = of_vtg_find(vtg_np);
+       of_node_put(vtg_np);
 
        platform_set_drvdata(pdev, hqvdp);
 
--

1.9.1

Signature · 11 lines
Benjamin Gaignard

Graphic Working Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#8 lore raw

PATCH 5/7 gpu: drm: sti_vtg: 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 Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_vtg.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/sti/sti_vtg.c +1 -0
index 6bf4ce4..0100c7c 100644
@@ -432,6 +432,7 @@ static int vtg_probe(struct platform_device *pdev)
 	np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
 	if (np) {
 		vtg->slave = of_vtg_find(np);
+		of_node_put(np);
 
 		if (!vtg->slave)
 			return -EPROBE_DEFER;
Signature · 1 line
1.9.1
Acked-by on v1 5/7
#9 lore raw

Re: [PATCH 5/7] gpu: drm: sti_vtg: add missing of_node_put after calling of_parse_phandle

2016-07-05 4:04 GMT+02:00 Peter Chen <[email protected]>:

Quoted 25 lines

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

Cc Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
---
 drivers/gpu/drm/sti/sti_vtg.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/sti/sti_vtg.c +1 -1
index 6bf4ce4..0100c7c 100644
@@ -432,6 +432,7 @@ static int vtg_probe(struct platform_device *pdev)
        np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
        if (np) {
                vtg->slave = of_vtg_find(np);
+               of_node_put(np);
 
                if (!vtg->slave)
                        return -EPROBE_DEFER;
--

1.9.1

Signature · 11 lines
Benjamin Gaignard

Graphic Working Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#10 lore raw

PATCH 6/7 gpu: drm: sun4i_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 Maxime Ripard <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/sun4i/sun4i_drv.c +1 -0
index 76e922b..ca291ba 100644
@@ -318,6 +318,7 @@ static int sun4i_drv_probe(struct platform_device *pdev)
 
 		count += sun4i_drv_add_endpoints(&pdev->dev, &match,
 						pipeline);
+		of_node_put(pipeline);
 
 		DRM_DEBUG_DRIVER("Queued %d outputs on pipeline %d\n",
 				 count, i);
Signature · 1 line
1.9.1
#11 lore raw

Re: [PATCH 6/7] gpu: drm: sun4i_drv: add missing of_node_put after calling of_parse_phandle

Quoted 6 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 Maxime Ripard <[email protected]>
Cc Chen-Yu Tsai <[email protected]>

Applied, thanks!
Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

author
#12 lore raw

PATCH 7/7 gpu: drm: vc4_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.

---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +7 -6
index fd2644d..26b6b06 100644
@@ -465,12 +465,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
 	if (IS_ERR(hdmi->hd_regs))
 		return PTR_ERR(hdmi->hd_regs);
 
-	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
-	if (!ddc_node) {
-		DRM_ERROR("Failed to find ddc node in device tree\n");
-		return -ENODEV;
-	}
-
 	hdmi->pixel_clock = devm_clk_get(dev, "pixel");
 	if (IS_ERR(hdmi->pixel_clock)) {
 		DRM_ERROR("Failed to get pixel clock\n");
@@ -482,7 +476,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
 		return PTR_ERR(hdmi->hsm_clock);
 	}
 
+	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
+	if (!ddc_node) {
+		DRM_ERROR("Failed to find ddc node in device tree\n");
+		return -ENODEV;
+	}
+
 	hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
+	of_node_put(ddc_node);
 	if (!hdmi->ddc) {
 		DRM_DEBUG("Failed to get ddc i2c adapter by node\n");
 		return -EPROBE_DEFER;
Signature · 1 line
1.9.1
Reviewed-by on v1 7/7
#13 lore raw

Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle

Quoted 32 lines · Peter Chen

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

---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -6
index fd2644d..26b6b06 100644
@@ -465,12 +465,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
 	if (IS_ERR(hdmi->hd_regs))
 		return PTR_ERR(hdmi->hd_regs);
 
-	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
-	if (!ddc_node) {
-		DRM_ERROR("Failed to find ddc node in device tree\n");
-		return -ENODEV;
-	}
-
 	hdmi->pixel_clock = devm_clk_get(dev, "pixel");
 	if (IS_ERR(hdmi->pixel_clock)) {
 		DRM_ERROR("Failed to get pixel clock\n");
@@ -482,7 +476,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
 		return PTR_ERR(hdmi->hsm_clock);
 	}
 
+	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);

drivers/gpu/drm/vc4/vc4_hdmi.c static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) · line 489

Quoted 10 lines
drivers/gpu/drm/vc4/vc4_hdmi.c +6 -0
+	if (!ddc_node) {
+		DRM_ERROR("Failed to find ddc node in device tree\n");
+		return -ENODEV;
+	}
+
 	hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
+	of_node_put(ddc_node);
 	if (!hdmi->ddc) {
 		DRM_DEBUG("Failed to get ddc i2c adapter by node\n");
 		return -EPROBE_DEFER;

It would be nice if we could just pass the phandle spec directly to the i2c function. OF code always seems terribly verbose to me (and error-prone in this exact way) because of the separate phandle lookup.

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

#14 lore raw

Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle

Quoted 47 lines · Eric Anholt
Quoted 32 lines · Peter Chen

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

---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -6
index fd2644d..26b6b06 100644
@@ -465,12 +465,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
 	if (IS_ERR(hdmi->hd_regs))
 		return PTR_ERR(hdmi->hd_regs);
 
-	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
-	if (!ddc_node) {
-		DRM_ERROR("Failed to find ddc node in device tree\n");
-		return -ENODEV;
-	}
-
 	hdmi->pixel_clock = devm_clk_get(dev, "pixel");
 	if (IS_ERR(hdmi->pixel_clock)) {
 		DRM_ERROR("Failed to get pixel clock\n");
@@ -482,7 +476,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
 		return PTR_ERR(hdmi->hsm_clock);
 	}
 
+	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);

drivers/gpu/drm/vc4/vc4_hdmi.c static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) · line 489

Quoted 10 lines
drivers/gpu/drm/vc4/vc4_hdmi.c +6 -0
+	if (!ddc_node) {
+		DRM_ERROR("Failed to find ddc node in device tree\n");
+		return -ENODEV;
+	}
+
 	hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
+	of_node_put(ddc_node);
 	if (!hdmi->ddc) {
 		DRM_DEBUG("Failed to get ddc i2c adapter by node\n");
 		return -EPROBE_DEFER;
Quoted 3 lines

It would be nice if we could just pass the phandle spec directly to the i2c function. OF code always seems terribly verbose to me (and error-prone in this exact way) because of the separate phandle lookup.

Yeah, of_find_i2c_adapter_by_phandle would be neat. Either way, applied all the other patches to drm-misc.
-Daniel

Quoted 4 lines

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

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Applied
#15 lore raw

Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen
Quoted 5 lines · Peter Chen

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

Applied this to drm-vc4-next. Thanks!

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