linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP2+: Fix refcount leak in omapdss_init_of
@ 2022-06-01  4:48 Miaoqian Lin
  2022-06-01  6:50 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2022-06-01  4:48 UTC (permalink / raw)
  To: Tony Lindgren, Russell King, Laurent Pinchart, Tomi Valkeinen,
	Sebastian Reichel, linux-arm-kernel, linux-omap, linux-kernel
  Cc: linmq006

omapdss_find_dss_of_node() calls of_find_compatible_node() to get device
node. of_find_compatible_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() in later error path and normal path.

Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/arm/mach-omap2/display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 21413a9b7b6c..ed2cb2649cf6 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -259,11 +259,13 @@ static int __init omapdss_init_of(void)
 
 	if (!pdev) {
 		pr_err("Unable to find DSS platform device\n");
+		of_node_put(node);
 		return -ENODEV;
 	}
 
 	r = of_platform_populate(node, NULL, NULL, &pdev->dev);
 	put_device(&pdev->dev);
+	of_node_put(node);
 	if (r) {
 		pr_err("Unable to populate DSS submodule devices\n");
 		return r;
-- 
2.25.1


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

* Re: [PATCH] ARM: OMAP2+: Fix refcount leak in omapdss_init_of
  2022-06-01  4:48 [PATCH] ARM: OMAP2+: Fix refcount leak in omapdss_init_of Miaoqian Lin
@ 2022-06-01  6:50 ` Laurent Pinchart
  2022-06-28  4:36   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2022-06-01  6:50 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Tony Lindgren, Russell King, Tomi Valkeinen, Sebastian Reichel,
	linux-arm-kernel, linux-omap, linux-kernel

Hello Lin,

Thank you for the patch.

On Wed, Jun 01, 2022 at 08:48:58AM +0400, Miaoqian Lin wrote:
> omapdss_find_dss_of_node() calls of_find_compatible_node() to get device
> node. of_find_compatible_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> Add missing of_node_put() in later error path and normal path.
> 
> Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  arch/arm/mach-omap2/display.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> index 21413a9b7b6c..ed2cb2649cf6 100644
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -259,11 +259,13 @@ static int __init omapdss_init_of(void)
>  
>  	if (!pdev) {
>  		pr_err("Unable to find DSS platform device\n");
> +		of_node_put(node);
>  		return -ENODEV;
>  	}
>  
>  	r = of_platform_populate(node, NULL, NULL, &pdev->dev);
>  	put_device(&pdev->dev);
> +	of_node_put(node);
>  	if (r) {
>  		pr_err("Unable to populate DSS submodule devices\n");
>  		return r;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] ARM: OMAP2+: Fix refcount leak in omapdss_init_of
  2022-06-01  6:50 ` Laurent Pinchart
@ 2022-06-28  4:36   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2022-06-28  4:36 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Miaoqian Lin, Russell King, Tomi Valkeinen, Sebastian Reichel,
	linux-arm-kernel, linux-omap, linux-kernel

* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [220601 06:46]:
> Hello Lin,
> 
> Thank you for the patch.
> 
> On Wed, Jun 01, 2022 at 08:48:58AM +0400, Miaoqian Lin wrote:
> > omapdss_find_dss_of_node() calls of_find_compatible_node() to get device
> > node. of_find_compatible_node() returns a node pointer with refcount
> > incremented, we should use of_node_put() on it when done.
> > Add missing of_node_put() in later error path and normal path.
> > 
> > Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")
> > Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Thanks applying this into omap-for-v5.20/soc.

Regards,

Tony

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

end of thread, other threads:[~2022-06-28  4:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  4:48 [PATCH] ARM: OMAP2+: Fix refcount leak in omapdss_init_of Miaoqian Lin
2022-06-01  6:50 ` Laurent Pinchart
2022-06-28  4:36   ` Tony Lindgren

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).