linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] add missing of_node_put after of_device_is_available
@ 2019-02-23 13:20 Julia Lawall
  2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
  2019-02-23 13:20 ` [PATCH 11/12] ARM: OMAP2+: " Julia Lawall
  0 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: linux-amlogic
  Cc: linux-fbdev, linux-pm, kernel-janitors, linux-kernel, dri-devel,
	linux-crypto, linux-tegra, linux-omap, linuxppc-dev,
	linux-arm-kernel

Failure of of_device_is_available implies that the device node
should be put, if it is not used otherwise.

---

 arch/arm/mach-omap2/display.c                            |    4 +++-
 arch/powerpc/platforms/83xx/usb.c                        |    4 +++-
 drivers/bus/arm-cci.c                                    |    4 +++-
 drivers/cpufreq/armada-8k-cpufreq.c                      |    4 +++-
 drivers/crypto/amcc/crypto4xx_trng.c                     |    4 +++-
 drivers/firmware/psci.c                                  |    4 +++-
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c          |    4 +++-
 drivers/gpu/drm/tegra/rgb.c                              |    4 +++-
 drivers/phy/tegra/xusb.c                                 |    4 +++-
 drivers/soc/amlogic/meson-gx-socinfo.c                   |    4 +++-
 drivers/tee/optee/core.c                                 |    4 +++-
 drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c |    4 +++-
 12 files changed, 36 insertions(+), 12 deletions(-)

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

* [PATCH 06/12] omapfb: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 [PATCH 00/12] add missing of_node_put after of_device_is_available Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-04-01 12:07   ` Bartlomiej Zolnierkiewicz
  2019-02-23 13:20 ` [PATCH 11/12] ARM: OMAP2+: " Julia Lawall
  1 sibling, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: kernel-janitors, linux-omap, linux-fbdev, dri-devel, linux-kernel

Add an of_node_put when a tested device node is not available.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
identifier f;
local idexpression e;
expression x;
@@

e = f(...);
... when != of_node_put(e)
    when != x = e
    when != e = x
    when any
if (<+...of_device_is_available(e)...+>) {
  ... when != of_node_put(e)
(
  return e;
|
+ of_node_put(e);
  return ...;
)
}
// </smpl>

Fixes: f76ee892a99e6 ("omapfb: copy omapdss & displays for omapfb")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
--- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
@@ -193,8 +193,10 @@ static int __init omapdss_boot_init(void
 
 	dss = of_find_matching_node(NULL, omapdss_of_match);
 
-	if (dss == NULL || !of_device_is_available(dss))
+	if (dss == NULL || !of_device_is_available(dss)) {
+		of_node_put(dss);
 		return 0;
+	}
 
 	omapdss_walk_device(dss, true);
 

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

* [PATCH 11/12] ARM: OMAP2+: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 [PATCH 00/12] add missing of_node_put after of_device_is_available Julia Lawall
  2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-03-22 22:24   ` Tony Lindgren
  2019-04-14 16:38   ` [11/12] " Markus Elfring
  1 sibling, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: kernel-janitors, Russell King, linux-omap, linux-arm-kernel,
	linux-kernel

Add an of_node_put when a tested device node is not available.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
identifier f;
local idexpression e;
expression x;
@@

e = f(...);
... when != of_node_put(e)
    when != x = e
    when != e = x
    when any
if (<+...of_device_is_available(e)...+>) {
  ... when != of_node_put(e)
(
  return e;
|
+ of_node_put(e);
  return ...;
)
}
// </smpl>

Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/arm/mach-omap2/display.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -250,8 +250,10 @@ static int __init omapdss_init_of(void)
 	if (!node)
 		return 0;
 
-	if (!of_device_is_available(node))
+	if (!of_device_is_available(node)) {
+		of_node_put(node);
 		return 0;
+	}
 
 	pdev = of_find_device_by_node(node);
 

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

* Re: [PATCH 11/12] ARM: OMAP2+: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 11/12] ARM: OMAP2+: " Julia Lawall
@ 2019-03-22 22:24   ` Tony Lindgren
  2019-04-14 16:38   ` [11/12] " Markus Elfring
  1 sibling, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2019-03-22 22:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-omap, kernel-janitors, Russell King, linux-arm-kernel,
	linux-kernel

* Julia Lawall <Julia.Lawall@lip6.fr> [190223 13:58]:
> Add an of_node_put when a tested device node is not available.
> 
> The semantic patch that fixes this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @@
> identifier f;
> local idexpression e;
> expression x;
> @@
> 
> e = f(...);
> ... when != of_node_put(e)
>     when != x = e
>     when != e = x
>     when any
> if (<+...of_device_is_available(e)...+>) {
>   ... when != of_node_put(e)
> (
>   return e;
> |
> + of_node_put(e);
>   return ...;
> )
> }
> // </smpl>
> 
> Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Thanks applying this one into omap-for-v5.1/fixes.

Regards,

Tony

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

* Re: [PATCH 06/12] omapfb: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
@ 2019-04-01 12:07   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-04-01 12:07 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, linux-omap, linux-fbdev, dri-devel, linux-kernel


On 02/23/2019 02:20 PM, Julia Lawall wrote:
> Add an of_node_put when a tested device node is not available.
> 
> The semantic patch that fixes this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @@
> identifier f;
> local idexpression e;
> expression x;
> @@
> 
> e = f(...);
> ... when != of_node_put(e)
>     when != x = e
>     when != e = x
>     when any
> if (<+...of_device_is_available(e)...+>) {
>   ... when != of_node_put(e)
> (
>   return e;
> |
> + of_node_put(e);
>   return ...;
> )
> }
> // </smpl>
> 
> Fixes: f76ee892a99e6 ("omapfb: copy omapdss & displays for omapfb")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Patch queued for v5.2, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

* Re: [11/12] ARM: OMAP2+: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 11/12] ARM: OMAP2+: " Julia Lawall
  2019-03-22 22:24   ` Tony Lindgren
@ 2019-04-14 16:38   ` Markus Elfring
  2019-04-14 16:49     ` Julia Lawall
  1 sibling, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2019-04-14 16:38 UTC (permalink / raw)
  To: Julia Lawall, Tony Lindgren, linux-omap, linux-arm-kernel
  Cc: kernel-janitors, linux-kernel, Russell King

> @@ -250,8 +250,10 @@ static int __init omapdss_init_of(void)
>  	if (!node)
>  		return 0;
>
> -	if (!of_device_is_available(node))
> +	if (!of_device_is_available(node)) {
> +		of_node_put(node);
>  		return 0;
> +	}
>
>  	pdev = of_find_device_by_node(node);

Is there a need to put the node also in subsequent if branches
for complete exception handling in this function implementation?

Regards,
Markus

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

* Re: [11/12] ARM: OMAP2+: add missing of_node_put after of_device_is_available
  2019-04-14 16:38   ` [11/12] " Markus Elfring
@ 2019-04-14 16:49     ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2019-04-14 16:49 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Tony Lindgren, linux-omap, linux-arm-kernel, kernel-janitors,
	linux-kernel, Russell King



On Sun, 14 Apr 2019, Markus Elfring wrote:

> > @@ -250,8 +250,10 @@ static int __init omapdss_init_of(void)
> >  	if (!node)
> >  		return 0;
> >
> > -	if (!of_device_is_available(node))
> > +	if (!of_device_is_available(node)) {
> > +		of_node_put(node);
> >  		return 0;
> > +	}
> >
> >  	pdev = of_find_device_by_node(node);
>
> Is there a need to put the node also in subsequent if branches
> for complete exception handling in this function implementation?

Yes, it looks like this is indeed missing.  I will try to send a better
patch when time permits.

julia

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

end of thread, other threads:[~2019-04-14 16:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-23 13:20 [PATCH 00/12] add missing of_node_put after of_device_is_available Julia Lawall
2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
2019-04-01 12:07   ` Bartlomiej Zolnierkiewicz
2019-02-23 13:20 ` [PATCH 11/12] ARM: OMAP2+: " Julia Lawall
2019-03-22 22:24   ` Tony Lindgren
2019-04-14 16:38   ` [11/12] " Markus Elfring
2019-04-14 16:49     ` Julia Lawall

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