dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/imx/dcss: Add missing of_node_put() in fail path
@ 2022-07-14  8:13 Liang He
  2022-07-20  7:50 ` Laurentiu Palcu
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-07-14  8:13 UTC (permalink / raw)
  To: laurentiu.palcu, l.stach, airlied, daniel, shawnguo, s.hauer,
	festevam, linux-imx, dri-devel, windhl

In dcss_dev_create() and dcss_dev_destroy(), we should call of_node_put()
in fail path or before the dcss's destroy as of_graph_get_port_by_id() has
increased the refcount.
 
Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
Signed-off-by: Liang He <windhl@126.com>
---
 changelog:

 v2: add of_node_put() in dcss_dev_destroy() advised by Laurentiu
 v1: only fix bug in dcss_dev_create().

 v1 link: https://lore.kernel.org/all/20220707023214.307451-1-windhl@126.com/


 drivers/gpu/drm/imx/dcss/dcss-dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c
index c849533ca83e..3f5750cc2673 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-dev.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c
@@ -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;
 	}
@@ -237,6 +238,8 @@ void dcss_dev_destroy(struct dcss_dev *dcss)
 		dcss_clocks_disable(dcss);
 	}
 
+	of_node_put(dcss->of_port);
+
 	pm_runtime_disable(dcss->dev);
 
 	dcss_submodules_stop(dcss);
-- 
2.25.1


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

* Re: [PATCH v2] drm/imx/dcss: Add missing of_node_put() in fail path
  2022-07-14  8:13 [PATCH v2] drm/imx/dcss: Add missing of_node_put() in fail path Liang He
@ 2022-07-20  7:50 ` Laurentiu Palcu
  0 siblings, 0 replies; 2+ messages in thread
From: Laurentiu Palcu @ 2022-07-20  7:50 UTC (permalink / raw)
  To: Liang He; +Cc: airlied, shawnguo, s.hauer, dri-devel, linux-imx

Hi,

On Thu, Jul 14, 2022 at 04:13:37PM +0800, Liang He wrote:
> In dcss_dev_create() and dcss_dev_destroy(), we should call of_node_put()
> in fail path or before the dcss's destroy as of_graph_get_port_by_id() has
> increased the refcount.
>  
> Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
> Signed-off-by: Liang He <windhl@126.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>

Applied to drm-misc-fixes.

Thanks,
Laurentiu

> ---
>  changelog:
> 
>  v2: add of_node_put() in dcss_dev_destroy() advised by Laurentiu
>  v1: only fix bug in dcss_dev_create().
> 
>  v1 link: https://lore.kernel.org/all/20220707023214.307451-1-windhl@126.com/
> 
> 
>  drivers/gpu/drm/imx/dcss/dcss-dev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c
> index c849533ca83e..3f5750cc2673 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-dev.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c
> @@ -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;
>  	}
> @@ -237,6 +238,8 @@ void dcss_dev_destroy(struct dcss_dev *dcss)
>  		dcss_clocks_disable(dcss);
>  	}
>  
> +	of_node_put(dcss->of_port);
> +
>  	pm_runtime_disable(dcss->dev);
>  
>  	dcss_submodules_stop(dcss);
> -- 
> 2.25.1
> 

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

end of thread, other threads:[~2022-07-20  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14  8:13 [PATCH v2] drm/imx/dcss: Add missing of_node_put() in fail path Liang He
2022-07-20  7:50 ` Laurentiu Palcu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).