* [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 02/12] drm/tegra: rgb: " Julia Lawall
` (2 more replies)
0 siblings, 3 replies; 8+ 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] 8+ messages in thread* [PATCH 02/12] drm/tegra: rgb: 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:49 ` Mukesh Ojha
2019-04-14 15:01 ` Markus Elfring
2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
2019-02-23 13:20 ` [PATCH 07/12] drm: omapdrm: " Julia Lawall
2 siblings, 2 replies; 8+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
To: Thierry Reding
Cc: kernel-janitors, David Airlie, Daniel Vetter, Jonathan Hunter,
dri-devel, linux-tegra, 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: d8f4a9eda0067 ("drm: Add NVIDIA Tegra20 support")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/gpu/drm/tegra/rgb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff -u -p a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
--- a/drivers/gpu/drm/tegra/rgb.c
+++ b/drivers/gpu/drm/tegra/rgb.c
@@ -221,8 +221,10 @@ int tegra_dc_rgb_probe(struct tegra_dc *
int err;
np = of_get_child_by_name(dc->dev->of_node, "rgb");
- if (!np || !of_device_is_available(np))
+ if (!np || !of_device_is_available(np)) {
+ of_node_put(np);
return -ENODEV;
+ }
rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL);
if (!rgb)
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 02/12] drm/tegra: rgb: add missing of_node_put after of_device_is_available
2019-02-23 13:20 ` [PATCH 02/12] drm/tegra: rgb: " Julia Lawall
@ 2019-04-01 12:49 ` Mukesh Ojha
2019-04-14 15:01 ` Markus Elfring
1 sibling, 0 replies; 8+ messages in thread
From: Mukesh Ojha @ 2019-04-01 12:49 UTC (permalink / raw)
To: Julia Lawall, Thierry Reding
Cc: kernel-janitors, David Airlie, Daniel Vetter, Jonathan Hunter,
dri-devel, linux-tegra, linux-kernel
On 2/23/2019 6:50 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: d8f4a9eda0067 ("drm: Add NVIDIA Tegra20 support")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cheers,
-Mukesh
>
> ---
> drivers/gpu/drm/tegra/rgb.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
> --- a/drivers/gpu/drm/tegra/rgb.c
> +++ b/drivers/gpu/drm/tegra/rgb.c
> @@ -221,8 +221,10 @@ int tegra_dc_rgb_probe(struct tegra_dc *
> int err;
>
> np = of_get_child_by_name(dc->dev->of_node, "rgb");
> - if (!np || !of_device_is_available(np))
> + if (!np || !of_device_is_available(np)) {
> + of_node_put(np);
> return -ENODEV;
> + }
>
> rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL);
> if (!rgb)
>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 02/12] drm/tegra: rgb: add missing of_node_put after of_device_is_available
2019-02-23 13:20 ` [PATCH 02/12] drm/tegra: rgb: " Julia Lawall
2019-04-01 12:49 ` Mukesh Ojha
@ 2019-04-14 15:01 ` Markus Elfring
1 sibling, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2019-04-14 15:01 UTC (permalink / raw)
To: Julia Lawall, Mukesh Ojha, dri-devel, linux-tegra
Cc: kernel-janitors, linux-kernel, Daniel Vetter, David Airlie,
Jonathan Hunter, Thierry Reding
> @@ -221,8 +221,10 @@ int tegra_dc_rgb_probe(struct tegra_dc *
> int err;
>
> np = of_get_child_by_name(dc->dev->of_node, "rgb");
> - if (!np || !of_device_is_available(np))
> + if (!np || !of_device_is_available(np)) {
> + of_node_put(np);
> return -ENODEV;
> + }
>
> rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL);
> if (!rgb)
How do you think about to move this function call to an additional jump target
for the desired exception handling?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ 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 ` [PATCH 02/12] drm/tegra: rgb: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
2019-04-01 12:07 ` Bartlomiej Zolnierkiewicz
2019-02-23 13:20 ` [PATCH 07/12] drm: omapdrm: " Julia Lawall
2 siblings, 1 reply; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread
* [PATCH 07/12] drm: omapdrm: 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 02/12] drm/tegra: rgb: " Julia Lawall
2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
2019-04-01 12:58 ` Mukesh Ojha
2 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: kernel-janitors, David Airlie, Daniel Vetter, 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: f2dd36ac9974c ("OMAPDSS: move 'compatible' converter to omapdss driver")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff -u -p a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -192,8 +192,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] 8+ messages in thread* Re: [PATCH 07/12] drm: omapdrm: add missing of_node_put after of_device_is_available
2019-02-23 13:20 ` [PATCH 07/12] drm: omapdrm: " Julia Lawall
@ 2019-04-01 12:58 ` Mukesh Ojha
0 siblings, 0 replies; 8+ messages in thread
From: Mukesh Ojha @ 2019-04-01 12:58 UTC (permalink / raw)
To: Julia Lawall, Tomi Valkeinen
Cc: kernel-janitors, David Airlie, Daniel Vetter, dri-devel,
linux-kernel
On 2/23/2019 6:50 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: f2dd36ac9974c ("OMAPDSS: move 'compatible' converter to omapdss driver")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cheers,
-Mukesh
>
> ---
> drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> @@ -192,8 +192,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] 8+ messages in thread
end of thread, other threads:[~2019-04-14 15:01 UTC | newest]
Thread overview: 8+ 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 02/12] drm/tegra: rgb: " Julia Lawall
2019-04-01 12:49 ` Mukesh Ojha
2019-04-14 15:01 ` Markus Elfring
2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
2019-04-01 12:07 ` Bartlomiej Zolnierkiewicz
2019-02-23 13:20 ` [PATCH 07/12] drm: omapdrm: " Julia Lawall
2019-04-01 12:58 ` Mukesh Ojha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox