Skip to contentSkip to conversation

drm/imx/dcss: Add missing of_node_put() in fail path

PATCH Superseded Liang He 2 participants 3 messages Jul 7, 2022 – Jul 14, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 drm/imx/dcss: Add missing of_node_put() in fail path

In dcss_dev_create(), we should call of_node_put() in fail path for of_graph_get_port_by_id() which will increase the refcount.

Fixes 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
---
 drivers/gpu/drm/imx/dcss/dcss-dev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/imx/dcss/dcss-dev.c +1 -0
index c849533ca83e..a99141538621 100644
@@ -207,6 +207,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
 
 	ret = dcss_submodules_init(dcss);
 	if (ret) {
+		of_node_put(dcss->of_port);
 		dev_err(dev, "submodules initialization failed\n");
 		goto clks_err;
 	}
Signature · 1 line
2.25.1
maintainer
#1 lore raw

Hi Liang,

Thanks for the patch.

The patch is ok but, since you're at it, maybe add of_node_put() in the dcss_dev_destroy() too?

Thanks,
laurentiu

Quoted 24 lines · Liang He

In dcss_dev_create(), we should call of_node_put() in fail path for of_graph_get_port_by_id() which will increase the refcount.

Fixes 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
---
 drivers/gpu/drm/imx/dcss/dcss-dev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/imx/dcss/dcss-dev.c +1 -0
index c849533ca83e..a99141538621 100644
@@ -207,6 +207,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
 
 	ret = dcss_submodules_init(dcss);
 	if (ret) {
+		of_node_put(dcss->of_port);
 		dev_err(dev, "submodules initialization failed\n");
 		goto clks_err;
 	}
Signature · 1 line
2.25.1
author
#2 lore raw
Quoted 8 lines · Laurentiu Palcu

Hi Liang,

Thanks for the patch.

The patch is ok but, since you're at it, maybe add of_node_put() in the dcss_dev_destroy() too?

Thanks, laurentiu,
I miss it and I will add it soon.

Quoted 28 lines

Thanks,
laurentiu

Quoted 24 lines · Liang He

In dcss_dev_create(), we should call of_node_put() in fail path for of_graph_get_port_by_id() which will increase the refcount.

Fixes 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
---
 drivers/gpu/drm/imx/dcss/dcss-dev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/imx/dcss/dcss-dev.c +1 -0
index c849533ca83e..a99141538621 100644
@@ -207,6 +207,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
 
 	ret = dcss_submodules_init(dcss);
 	if (ret) {
+		of_node_put(dcss->of_port);
 		dev_err(dev, "submodules initialization failed\n");
 		goto clks_err;
 	}
Signature · 1 line
2.25.1