linux-kernel.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 01/12] arm-cci: " Julia Lawall
                   ` (11 more replies)
  0 siblings, 12 replies; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: linux-amlogic
  Cc: kernel-janitors, linux-arm-kernel, linuxppc-dev, linux-kernel,
	dri-devel, linux-tegra, linux-omap, linux-fbdev, linux-crypto,
	linux-pm

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] 33+ messages in thread

* [PATCH 01/12] arm-cci: 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:48   ` Mukesh Ojha
  2019-04-14 14:45   ` Markus Elfring
  2019-02-23 13:20 ` [PATCH 02/12] drm/tegra: rgb: " Julia Lawall
                   ` (10 subsequent siblings)
  11 siblings, 2 replies; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: linux-kernel, linux, robin.murphy; +Cc: kernel-janitors

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: 896ddd600ba4 ("drivers: bus: check cci device tree node status")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
This file doesn't seem to have a maintainer.

 drivers/bus/arm-cci.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -538,8 +538,10 @@ static int cci_probe(void)
 	struct resource res;
 
 	np = of_find_matching_node(NULL, arm_cci_matches);
-	if (!of_device_is_available(np))
+	if (!of_device_is_available(np)) {
+		of_node_put(np);
 		return -ENODEV;
+	}
 
 	ret = of_address_to_resource(np, 0, &res);
 	if (!ret) {


^ permalink raw reply	[flat|nested] 33+ 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 ` [PATCH 01/12] arm-cci: " 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 03/12] PowerPC-83xx: " Julia Lawall
                   ` (9 subsequent siblings)
  11 siblings, 2 replies; 33+ 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] 33+ messages in thread

* [PATCH 03/12] PowerPC-83xx: 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 01/12] arm-cci: " 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:49   ` Mukesh Ojha
  2019-04-14 15:25   ` Markus Elfring
  2019-02-23 13:20 ` [PATCH 04/12] phy: tegra: " Julia Lawall
                   ` (8 subsequent siblings)
  11 siblings, 2 replies; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Scott Wood
  Cc: kernel-janitors, Kumar Gala, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, linuxppc-dev, 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: c026c98739c7e ("powerpc/83xx: Do not configure or probe disabled FSL DR USB controllers")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/powerpc/platforms/83xx/usb.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -221,8 +221,10 @@ int mpc837x_usb_cfg(void)
 	int ret = 0;
 
 	np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr");
-	if (!np || !of_device_is_available(np))
+	if (!np || !of_device_is_available(np)) {
+		of_node_put(np);
 		return -ENODEV;
+	}
 	prop = of_get_property(np, "phy_type", NULL);
 
 	if (!prop || (strcmp(prop, "ulpi") && strcmp(prop, "serial"))) {


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

* [PATCH 04/12] phy: tegra: 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
                   ` (2 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 03/12] PowerPC-83xx: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-04-01 12:50   ` Mukesh Ojha
  2019-04-14 15:42   ` Markus Elfring
  2019-02-23 13:20 ` [PATCH 05/12] tee: optee: " Julia Lawall
                   ` (7 subsequent siblings)
  11 siblings, 2 replies; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: kernel-janitors, Thierry Reding, Jonathan Hunter, linux-kernel,
	linux-tegra

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: 53d2a715c2403 ("phy: Add Tegra XUSB pad controller support")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/phy/tegra/xusb.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -260,8 +260,10 @@ tegra_xusb_pad_create(struct tegra_xusb_
 	int err;
 
 	np = tegra_xusb_find_pad_node(padctl, soc->name);
-	if (!np || !of_device_is_available(np))
+	if (!np || !of_device_is_available(np)) {
+		of_node_put(np);
 		return NULL;
+	}
 
 	pad = soc->ops->probe(padctl, soc, np);
 	if (IS_ERR(pad)) {


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

* [PATCH 05/12] tee: optee: 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
                   ` (3 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 04/12] phy: tegra: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-02-28 11:17   ` Jens Wiklander
  2019-02-23 13:20 ` [PATCH 06/12] omapfb: " Julia Lawall
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Jens Wiklander; +Cc: kernel-janitors, 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: db878f76b9ff ("tee: optee: take DT status property into account")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/tee/optee/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -703,8 +703,10 @@ static int __init optee_driver_init(void
 		return -ENODEV;
 
 	np = of_find_matching_node(fw_np, optee_match);
-	if (!np || !of_device_is_available(np))
+	if (!np || !of_device_is_available(np)) {
+		of_node_put(np);
 		return -ENODEV;
+	}
 
 	optee = optee_probe(np);
 	of_node_put(np);


^ permalink raw reply	[flat|nested] 33+ 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
                   ` (4 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 05/12] tee: optee: " 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
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 33+ 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] 33+ 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
                   ` (5 preceding siblings ...)
  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
  2019-02-23 13:20 ` [PATCH 08/12] crypto: " Julia Lawall
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 33+ 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] 33+ messages in thread

* [PATCH 08/12] crypto: 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
                   ` (6 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 07/12] drm: omapdrm: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-02-28  6:39   ` Herbert Xu
  2019-02-23 13:20 ` [PATCH 09/12] meson-gx-socinfo: " Julia Lawall
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Herbert Xu; +Cc: kernel-janitors, David S. Miller, linux-crypto, 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: 5343e674f32fb ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/crypto/amcc/crypto4xx_trng.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/crypto/amcc/crypto4xx_trng.c b/drivers/crypto/amcc/crypto4xx_trng.c
--- a/drivers/crypto/amcc/crypto4xx_trng.c
+++ b/drivers/crypto/amcc/crypto4xx_trng.c
@@ -80,8 +80,10 @@ void ppc4xx_trng_probe(struct crypto4xx_
 
 	/* Find the TRNG device node and map it */
 	trng = of_find_matching_node(NULL, ppc4xx_trng_match);
-	if (!trng || !of_device_is_available(trng))
+	if (!trng || !of_device_is_available(trng)) {
+		of_node_put(trng);
 		return;
+	}
 
 	dev->trng_base = of_iomap(trng, 0);
 	of_node_put(trng);


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

* [PATCH 09/12] meson-gx-socinfo: 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
                   ` (7 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 08/12] crypto: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-03-12 20:28   ` Kevin Hilman
  2019-04-14 16:12   ` Markus Elfring
  2019-02-23 13:20 ` [PATCH 10/12] cpufreq: ap806: " Julia Lawall
                   ` (2 subsequent siblings)
  11 siblings, 2 replies; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: kernel-janitors, linux-arm-kernel, linux-amlogic, 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: a9daaba2965e8 ("soc: Add Amlogic SoC Information driver")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/soc/amlogic/meson-gx-socinfo.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c
--- a/drivers/soc/amlogic/meson-gx-socinfo.c
+++ b/drivers/soc/amlogic/meson-gx-socinfo.c
@@ -123,8 +123,10 @@ static int __init meson_gx_socinfo_init(
 		return -ENODEV;
 
 	/* check if interface is enabled */
-	if (!of_device_is_available(np))
+	if (!of_device_is_available(np)) {
+		of_node_put(np);
 		return -ENODEV;
+	}
 
 	/* check if chip-id is available */
 	if (!of_property_read_bool(np, "amlogic,has-chip-id"))


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

* [PATCH 10/12] cpufreq: ap806: 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
                   ` (8 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 09/12] meson-gx-socinfo: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-02-25  4:29   ` Viresh Kumar
  2019-02-23 13:20 ` [PATCH 11/12] ARM: OMAP2+: " Julia Lawall
  2019-02-23 13:20 ` [PATCH 12/12] drivers: firmware: psci: " Julia Lawall
  11 siblings, 1 reply; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Jason Cooper
  Cc: kernel-janitors, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Rafael J. Wysocki, Viresh Kumar,
	linux-arm-kernel, linux-pm, 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: f525a670533d9 ("cpufreq: ap806: add cpufreq driver for Armada 8K")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/cpufreq/armada-8k-cpufreq.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c
--- a/drivers/cpufreq/armada-8k-cpufreq.c
+++ b/drivers/cpufreq/armada-8k-cpufreq.c
@@ -128,8 +128,10 @@ static int __init armada_8k_cpufreq_init
 	struct cpumask cpus;
 
 	node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock");
-	if (!node || !of_device_is_available(node))
+	if (!node || !of_device_is_available(node)) {
+		of_node_put(node);
 		return -ENODEV;
+	}
 
 	nb_cpus = num_possible_cpus();
 	freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL);


^ permalink raw reply	[flat|nested] 33+ 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
                   ` (9 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 10/12] cpufreq: ap806: " 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
  2019-02-23 13:20 ` [PATCH 12/12] drivers: firmware: psci: " Julia Lawall
  11 siblings, 2 replies; 33+ 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] 33+ messages in thread

* [PATCH 12/12] drivers: firmware: psci: 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
                   ` (10 preceding siblings ...)
  2019-02-23 13:20 ` [PATCH 11/12] ARM: OMAP2+: " Julia Lawall
@ 2019-02-23 13:20 ` Julia Lawall
  2019-04-01 12:47   ` Mukesh Ojha
  11 siblings, 1 reply; 33+ messages in thread
From: Julia Lawall @ 2019-02-23 13:20 UTC (permalink / raw)
  To: Mark Rutland
  Cc: kernel-janitors, Lorenzo Pieralisi, 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: d09a0011ec0d5 ("drivers: psci: Allow PSCI node to be disabled")
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/firmware/psci.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -u -p a/drivers/firmware/psci.c b/drivers/firmware/psci.c
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -677,8 +677,10 @@ int __init psci_dt_init(void)
 
 	np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np);
 
-	if (!np || !of_device_is_available(np))
+	if (!np || !of_device_is_available(np)) {
+		of_node_put(np);
 		return -ENODEV;
+	}
 
 	init_fn = (psci_initcall_t)matched_np->data;
 	return init_fn(np);


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

* Re: [PATCH 10/12] cpufreq: ap806: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 10/12] cpufreq: ap806: " Julia Lawall
@ 2019-02-25  4:29   ` Viresh Kumar
  0 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2019-02-25  4:29 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jason Cooper, kernel-janitors, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Rafael J. Wysocki, linux-arm-kernel,
	linux-pm, linux-kernel

On 23-02-19, 14:20, 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: f525a670533d9 ("cpufreq: ap806: add cpufreq driver for Armada 8K")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/cpufreq/armada-8k-cpufreq.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff -u -p a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c
> --- a/drivers/cpufreq/armada-8k-cpufreq.c
> +++ b/drivers/cpufreq/armada-8k-cpufreq.c
> @@ -128,8 +128,10 @@ static int __init armada_8k_cpufreq_init
>  	struct cpumask cpus;
>  
>  	node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock");
> -	if (!node || !of_device_is_available(node))
> +	if (!node || !of_device_is_available(node)) {
> +		of_node_put(node);
>  		return -ENODEV;
> +	}
>  
>  	nb_cpus = num_possible_cpus();
>  	freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL);

Applied. Thanks.

-- 
viresh

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

* Re: [PATCH 08/12] crypto: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 08/12] crypto: " Julia Lawall
@ 2019-02-28  6:39   ` Herbert Xu
  0 siblings, 0 replies; 33+ messages in thread
From: Herbert Xu @ 2019-02-28  6:39 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, David S. Miller, linux-crypto, linux-kernel

On Sat, Feb 23, 2019 at 02:20:39PM +0100, 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: 5343e674f32fb ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/crypto/amcc/crypto4xx_trng.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH 05/12] tee: optee: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 05/12] tee: optee: " Julia Lawall
@ 2019-02-28 11:17   ` Jens Wiklander
  0 siblings, 0 replies; 33+ messages in thread
From: Jens Wiklander @ 2019-02-28 11:17 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Linux Kernel Mailing List

Hi Julia,
On Sat, Feb 23, 2019 at 2:58 PM Julia Lawall <Julia.Lawall@lip6.fr> 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: db878f76b9ff ("tee: optee: take DT status property into account")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>  drivers/tee/optee/core.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -703,8 +703,10 @@ static int __init optee_driver_init(void
>                 return -ENODEV;
>
>         np = of_find_matching_node(fw_np, optee_match);
> -       if (!np || !of_device_is_available(np))
> +       if (!np || !of_device_is_available(np)) {
> +               of_node_put(np);
>                 return -ENODEV;
> +       }
>
>         optee = optee_probe(np);
>         of_node_put(np);
>

Applied.

Thanks,
Jens

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

* Re: [PATCH 09/12] meson-gx-socinfo: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 09/12] meson-gx-socinfo: " Julia Lawall
@ 2019-03-12 20:28   ` Kevin Hilman
  2019-04-14 16:12   ` Markus Elfring
  1 sibling, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2019-03-12 20:28 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, linux-arm-kernel, linux-amlogic, linux-kernel

Julia Lawall <Julia.Lawall@lip6.fr> writes:

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

[...] 
]

> Fixes: a9daaba2965e8 ("soc: Add Amlogic SoC Information driver")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Patch applied,

Thanks,

Kevin

^ permalink raw reply	[flat|nested] 33+ 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; 33+ messages in thread
From: Tony Lindgren @ 2019-03-22 22:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Russell King, linux-omap, 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] 33+ 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; 33+ 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] 33+ messages in thread

* Re: [PATCH 12/12] drivers: firmware: psci: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 12/12] drivers: firmware: psci: " Julia Lawall
@ 2019-04-01 12:47   ` Mukesh Ojha
  0 siblings, 0 replies; 33+ messages in thread
From: Mukesh Ojha @ 2019-04-01 12:47 UTC (permalink / raw)
  To: Julia Lawall, Mark Rutland
  Cc: Lorenzo Pieralisi, kernel-janitors, linux-kernel, linux-arm-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://Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
>
> Cheers,
> -Mukesh.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: d09a0011ec0d5 ("drivers: psci: Allow PSCI node to be disabled")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh
>
> ---
>   drivers/firmware/psci.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/firmware/psci.c b/drivers/firmware/psci.c
> --- a/drivers/firmware/psci.c
> +++ b/drivers/firmware/psci.c
> @@ -677,8 +677,10 @@ int __init psci_dt_init(void)
>   
>   	np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np);
>   
> -	if (!np || !of_device_is_available(np))
> +	if (!np || !of_device_is_available(np)) {
> +		of_node_put(np);
>   		return -ENODEV;
> +	}
>   
>   	init_fn = (psci_initcall_t)matched_np->data;
>   	return init_fn(np);
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 01/12] arm-cci: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 01/12] arm-cci: " Julia Lawall
@ 2019-04-01 12:48   ` Mukesh Ojha
  2019-04-14 14:45   ` Markus Elfring
  1 sibling, 0 replies; 33+ messages in thread
From: Mukesh Ojha @ 2019-04-01 12:48 UTC (permalink / raw)
  To: Julia Lawall, linux-kernel, linux, robin.murphy; +Cc: kernel-janitors


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: 896ddd600ba4 ("drivers: bus: check cci device tree node status")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>


Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh

>
> ---
> This file doesn't seem to have a maintainer.
>
>   drivers/bus/arm-cci.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
> --- a/drivers/bus/arm-cci.c
> +++ b/drivers/bus/arm-cci.c
> @@ -538,8 +538,10 @@ static int cci_probe(void)
>   	struct resource res;
>   
>   	np = of_find_matching_node(NULL, arm_cci_matches);
> -	if (!of_device_is_available(np))
> +	if (!of_device_is_available(np)) {
> +		of_node_put(np);
>   		return -ENODEV;
> +	}
>   
>   	ret = of_address_to_resource(np, 0, &res);
>   	if (!ret) {
>

^ permalink raw reply	[flat|nested] 33+ 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; 33+ 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] 33+ messages in thread

* Re: [PATCH 03/12] PowerPC-83xx: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 03/12] PowerPC-83xx: " Julia Lawall
@ 2019-04-01 12:49   ` Mukesh Ojha
  2019-04-14 15:25   ` Markus Elfring
  1 sibling, 0 replies; 33+ messages in thread
From: Mukesh Ojha @ 2019-04-01 12:49 UTC (permalink / raw)
  To: Julia Lawall, Scott Wood
  Cc: kernel-janitors, Kumar Gala, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, linuxppc-dev, 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: c026c98739c7e ("powerpc/83xx: Do not configure or probe disabled FSL DR USB controllers")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh
>
> ---
>   arch/powerpc/platforms/83xx/usb.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -u -p a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
> --- a/arch/powerpc/platforms/83xx/usb.c
> +++ b/arch/powerpc/platforms/83xx/usb.c
> @@ -221,8 +221,10 @@ int mpc837x_usb_cfg(void)
>   	int ret = 0;
>   
>   	np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr");
> -	if (!np || !of_device_is_available(np))
> +	if (!np || !of_device_is_available(np)) {
> +		of_node_put(np);
>   		return -ENODEV;
> +	}
>   	prop = of_get_property(np, "phy_type", NULL);
>   
>   	if (!prop || (strcmp(prop, "ulpi") && strcmp(prop, "serial"))) {
>

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

* Re: [PATCH 04/12] phy: tegra: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 04/12] phy: tegra: " Julia Lawall
@ 2019-04-01 12:50   ` Mukesh Ojha
  2019-04-14 15:42   ` Markus Elfring
  1 sibling, 0 replies; 33+ messages in thread
From: Mukesh Ojha @ 2019-04-01 12:50 UTC (permalink / raw)
  To: Julia Lawall, Kishon Vijay Abraham I
  Cc: kernel-janitors, Thierry Reding, Jonathan Hunter, linux-kernel,
	linux-tegra


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: 53d2a715c2403 ("phy: Add Tegra XUSB pad controller support")
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh
>
> ---
>   drivers/phy/tegra/xusb.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
> --- a/drivers/phy/tegra/xusb.c
> +++ b/drivers/phy/tegra/xusb.c
> @@ -260,8 +260,10 @@ tegra_xusb_pad_create(struct tegra_xusb_
>   	int err;
>   
>   	np = tegra_xusb_find_pad_node(padctl, soc->name);
> -	if (!np || !of_device_is_available(np))
> +	if (!np || !of_device_is_available(np)) {
> +		of_node_put(np);
>   		return NULL;
> +	}
>   
>   	pad = soc->ops->probe(padctl, soc, np);
>   	if (IS_ERR(pad)) {
>

^ permalink raw reply	[flat|nested] 33+ 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; 33+ 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] 33+ messages in thread

* Re: [PATCH 01/12] arm-cci: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 01/12] arm-cci: " Julia Lawall
  2019-04-01 12:48   ` Mukesh Ojha
@ 2019-04-14 14:45   ` Markus Elfring
  2019-04-16 13:02     ` Robin Murphy
  1 sibling, 1 reply; 33+ messages in thread
From: Markus Elfring @ 2019-04-14 14:45 UTC (permalink / raw)
  To: Julia Lawall, Robin Murphy, linux; +Cc: linux-kernel, kernel-janitors

> @@ -538,8 +538,10 @@  static int cci_probe(void)
>  	struct resource res;
>
>  	np = of_find_matching_node(NULL, arm_cci_matches);
> -	if (!of_device_is_available(np))
> +	if (!of_device_is_available(np)) {
> +		of_node_put(np);
>  		return -ENODEV;
> +	}
>
>  	ret = of_address_to_resource(np, 0, &res);
>  	if (!ret) {

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] 33+ 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; 33+ 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] 33+ messages in thread

* Re: [PATCH 03/12] PowerPC-83xx: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 03/12] PowerPC-83xx: " Julia Lawall
  2019-04-01 12:49   ` Mukesh Ojha
@ 2019-04-14 15:25   ` Markus Elfring
  1 sibling, 0 replies; 33+ messages in thread
From: Markus Elfring @ 2019-04-14 15:25 UTC (permalink / raw)
  To: Julia Lawall, Mukesh Ojha, Scott Wood, linuxppc-dev
  Cc: kernel-janitors, linux-kernel, Benjamin Herrenschmidt,
	Kumar Gala, Michael Ellerman, Paul Mackerras

> @@ -221,8 +221,10 @@ int mpc837x_usb_cfg(void)
>  	int ret = 0;
>
>  	np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr");
> -	if (!np || !of_device_is_available(np))
> +	if (!np || !of_device_is_available(np)) {
> +		of_node_put(np);
>  		return -ENODEV;
> +	}
>  	prop = of_get_property(np, "phy_type", NULL);
>
>  	if (!prop || (strcmp(prop, "ulpi") && strcmp(prop, "serial"))) {

How do you think about to adjust the exception handling in this function
implementation a bit more according to the Linux coding style?

Regards,
Markus

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

* Re: [PATCH 04/12] phy: tegra: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 04/12] phy: tegra: " Julia Lawall
  2019-04-01 12:50   ` Mukesh Ojha
@ 2019-04-14 15:42   ` Markus Elfring
  1 sibling, 0 replies; 33+ messages in thread
From: Markus Elfring @ 2019-04-14 15:42 UTC (permalink / raw)
  To: Julia Lawall, Mukesh Ojha, linux-tegra
  Cc: Kishon Vijay Abraham I, kernel-janitors, linux-kernel,
	Jonathan Hunter, Thierry Reding

> @@ -260,8 +260,10 @@  tegra_xusb_pad_create(struct tegra_xusb_
>  	int err;
>
>  	np = tegra_xusb_find_pad_node(padctl, soc->name);
> -	if (!np || !of_device_is_available(np))
> +	if (!np || !of_device_is_available(np)) {
> +		of_node_put(np);
>  		return NULL;
> +	}
>
>  	pad = soc->ops->probe(padctl, soc, np);
>  	if (IS_ERR(pad)) {

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] 33+ messages in thread

* Re: [PATCH 09/12] meson-gx-socinfo: add missing of_node_put after of_device_is_available
  2019-02-23 13:20 ` [PATCH 09/12] meson-gx-socinfo: " Julia Lawall
  2019-03-12 20:28   ` Kevin Hilman
@ 2019-04-14 16:12   ` Markus Elfring
  1 sibling, 0 replies; 33+ messages in thread
From: Markus Elfring @ 2019-04-14 16:12 UTC (permalink / raw)
  To: Julia Lawall, Kevin Hilman, linux-amlogic, linux-arm-kernel
  Cc: kernel-janitors, linux-kernel

> @@ -123,8 +123,10 @@  static int __init meson_gx_socinfo_init(
>  		return -ENODEV;
>
>  	/* check if interface is enabled */
> -	if (!of_device_is_available(np))
> +	if (!of_device_is_available(np)) {
> +		of_node_put(np);
>  		return -ENODEV;
> +	}
>
>  	/* check if chip-id is available */
>  	if (!of_property_read_bool(np, "amlogic,has-chip-id"))

How do you think about to adjust the exception handling in this function
implementation a bit more according to the Linux coding style?

Regards,
Markus

^ permalink raw reply	[flat|nested] 33+ 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; 33+ 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] 33+ 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; 33+ 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] 33+ messages in thread

* Re: [PATCH 01/12] arm-cci: add missing of_node_put after of_device_is_available
  2019-04-14 14:45   ` Markus Elfring
@ 2019-04-16 13:02     ` Robin Murphy
  0 siblings, 0 replies; 33+ messages in thread
From: Robin Murphy @ 2019-04-16 13:02 UTC (permalink / raw)
  To: Markus Elfring, Julia Lawall, linux; +Cc: linux-kernel, kernel-janitors

On 14/04/2019 15:45, Markus Elfring wrote:
>> @@ -538,8 +538,10 @@  static int cci_probe(void)
>>   	struct resource res;
>>
>>   	np = of_find_matching_node(NULL, arm_cci_matches);
>> -	if (!of_device_is_available(np))
>> +	if (!of_device_is_available(np)) {
>> +		of_node_put(np);
>>   		return -ENODEV;
>> +	}
>>
>>   	ret = of_address_to_resource(np, 0, &res);
>>   	if (!ret) {
> 
> How do you think about to move this function call to an additional jump target
> for the desired exception handling?

TBH it looks like the whole thing could do with a bit of refactoring - 
strictly we should probably be dropping the node reference in all the 
other failure paths too.

Robin.

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

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

Thread overview: 33+ 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 01/12] arm-cci: " Julia Lawall
2019-04-01 12:48   ` Mukesh Ojha
2019-04-14 14:45   ` Markus Elfring
2019-04-16 13:02     ` Robin Murphy
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 03/12] PowerPC-83xx: " Julia Lawall
2019-04-01 12:49   ` Mukesh Ojha
2019-04-14 15:25   ` Markus Elfring
2019-02-23 13:20 ` [PATCH 04/12] phy: tegra: " Julia Lawall
2019-04-01 12:50   ` Mukesh Ojha
2019-04-14 15:42   ` Markus Elfring
2019-02-23 13:20 ` [PATCH 05/12] tee: optee: " Julia Lawall
2019-02-28 11:17   ` Jens Wiklander
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
2019-02-23 13:20 ` [PATCH 08/12] crypto: " Julia Lawall
2019-02-28  6:39   ` Herbert Xu
2019-02-23 13:20 ` [PATCH 09/12] meson-gx-socinfo: " Julia Lawall
2019-03-12 20:28   ` Kevin Hilman
2019-04-14 16:12   ` Markus Elfring
2019-02-23 13:20 ` [PATCH 10/12] cpufreq: ap806: " Julia Lawall
2019-02-25  4:29   ` Viresh Kumar
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
2019-02-23 13:20 ` [PATCH 12/12] drivers: firmware: psci: " Julia Lawall
2019-04-01 12:47   ` Mukesh Ojha

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