kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] add missing of_node_put
@ 2015-10-24 14:42 Julia Lawall
  2015-10-24 14:42 ` [PATCH 1/9] powerpc/powernv: " Julia Lawall
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Thomas Petazzoni, Andrew Lunn, Russell King - ARM Linux,
	Jason Cooper, linux-gpio, kernel-janitors, linux-kernel,
	dri-devel, linux-bluetooth, linux-tegra, Bjorn Helgaas,
	linux-leds

The various for_each device_node iterators performs an of_node_get on each
iteration, so a break out of the loop requires an of_node_put.

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

// <smpl>
@r@
local idexpression n;
expression e1,e2;
iterator name for_each_node_by_name, for_each_node_by_type,
for_each_compatible_node, for_each_matching_node,
for_each_matching_node_and_match, for_each_child_of_node,
for_each_available_child_of_node, for_each_node_with_property;
iterator i;
statement S;
expression list [n1] es;
@@

(
(
for_each_node_by_name(n,e1) S
|
for_each_node_by_type(n,e1) S
|
for_each_compatible_node(n,e1,e2) S
|
for_each_matching_node(n,e1) S
|
for_each_matching_node_and_match(n,e1,e2) S
|
for_each_child_of_node(e1,n) S
|
for_each_available_child_of_node(e1,n) S
|
for_each_node_with_property(n,e1) S
)
&
i(es,n,...) S
)

@@
local idexpression r.n;
iterator r.i;
expression e;
expression list [r.n1] es;
@@

 i(es,n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
   return n;
|
+  of_node_put(n);
?  return ...;
)
   ...
 }

@@
local idexpression r.n;
iterator r.i;
expression e;
expression list [r.n1] es;
@@

 i(es,n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  break;
)
   ...
 }
... when != n

@@
local idexpression r.n;
iterator r.i;
expression e;
identifier l;
expression list [r.n1] es;
@@

 i(es,n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  goto l;
)
   ...
 }
...
l: ... when != n// </smpl>

---

 drivers/bluetooth/btmrvl_main.c  |    5 ++++-
 drivers/gpu/drm/tegra/dc.c       |    4 +++-
 drivers/gpu/host1x/bus.c         |    4 +++-
 drivers/leds/leds-88pm860x.c     |    1 +
 drivers/leds/leds-bcm6328.c      |    4 +++-
 drivers/leds/leds-bcm6358.c      |    4 +++-
 drivers/leds/leds-powernv.c      |    8 ++++++--
 drivers/pinctrl/pinctrl-at91.c   |    5 ++++-
 drivers/soc/ti/knav_qmss_queue.c |    3 +++
 9 files changed, 30 insertions(+), 8 deletions(-)

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

* [PATCH 1/9] powerpc/powernv: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-24 14:42 ` [PATCH 2/9] leds: bcm6358: " Julia Lawall
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: Richard Purdie
  Cc: kernel-janitors, Jacek Anaszewski, linux-leds, linux-kernel,
	Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn,
	Bjorn Helgaas, Jason Cooper

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/leds/leds-powernv.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c
index 2c5c5b1..1e75e1f 100644
--- a/drivers/leds/leds-powernv.c
+++ b/drivers/leds/leds-powernv.c
@@ -262,15 +262,19 @@ static int powernv_led_classdev(struct platform_device *pdev,
 		while ((cur = of_prop_next_string(p, cur)) != NULL) {
 			powernv_led = devm_kzalloc(dev, sizeof(*powernv_led),
 						   GFP_KERNEL);
-			if (!powernv_led)
+			if (!powernv_led) {
+				of_node_put(np);
 				return -ENOMEM;
+			}
 
 			powernv_led->common = powernv_led_common;
 			powernv_led->loc_code = (char *)np->name;
 
 			rc = powernv_led_create(dev, powernv_led, cur);
-			if (rc)
+			if (rc) {
+				of_node_put(np);
 				return rc;
+			}
 		} /* while end */
 	}
 


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

* [PATCH 2/9] leds: bcm6358: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
  2015-10-24 14:42 ` [PATCH 1/9] powerpc/powernv: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-24 14:42 ` [PATCH 3/9] leds: bcm6328: " Julia Lawall
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: Richard Purdie
  Cc: kernel-janitors, Jacek Anaszewski, linux-leds, linux-kernel,
	Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn,
	Bjorn Helgaas, Jason Cooper

for_each_available_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_available_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

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

diff --git a/drivers/leds/leds-bcm6358.c b/drivers/leds/leds-bcm6358.c
index 7ea3526..82b4ee1 100644
--- a/drivers/leds/leds-bcm6358.c
+++ b/drivers/leds/leds-bcm6358.c
@@ -215,8 +215,10 @@ static int bcm6358_leds_probe(struct platform_device *pdev)
 		}
 
 		rc = bcm6358_led(dev, child, reg, mem, lock);
-		if (rc < 0)
+		if (rc < 0) {
+			of_node_put(child);
 			return rc;
+		}
 	}
 
 	return 0;


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

* [PATCH 3/9] leds: bcm6328: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
  2015-10-24 14:42 ` [PATCH 1/9] powerpc/powernv: " Julia Lawall
  2015-10-24 14:42 ` [PATCH 2/9] leds: bcm6358: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-24 14:42 ` [PATCH 4/9] leds: 88pm860x: " Julia Lawall
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: Richard Purdie
  Cc: kernel-janitors, Jacek Anaszewski, linux-leds, linux-kernel,
	Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn,
	Bjorn Helgaas, Jason Cooper

for_each_available_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_available_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

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

diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c
index 18de094..c7ea5c6 100644
--- a/drivers/leds/leds-bcm6328.c
+++ b/drivers/leds/leds-bcm6328.c
@@ -403,8 +403,10 @@ static int bcm6328_leds_probe(struct platform_device *pdev)
 			rc = bcm6328_led(dev, child, reg, mem, lock,
 					 blink_leds, blink_delay);
 
-		if (rc < 0)
+		if (rc < 0) {
+			of_node_put(child);
 			return rc;
+		}
 	}
 
 	return 0;


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

* [PATCH 4/9] leds: 88pm860x: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
                   ` (2 preceding siblings ...)
  2015-10-24 14:42 ` [PATCH 3/9] leds: bcm6328: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-24 14:42 ` [PATCH 5/9] drm/tegra: dc: " Julia Lawall
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: Richard Purdie
  Cc: kernel-janitors, Jacek Anaszewski, linux-leds, linux-kernel,
	Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn,
	Bjorn Helgaas, Jason Cooper

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
local idexpression n;
expression e,r;
@@

 for_each_child_of_node(r,n) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  break;
)
   ...
 }
... when != n
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/leds/leds-88pm860x.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c
index 1497a09..7870840 100644
--- a/drivers/leds/leds-88pm860x.c
+++ b/drivers/leds/leds-88pm860x.c
@@ -142,6 +142,7 @@ static int pm860x_led_dt_init(struct platform_device *pdev,
 			of_property_read_u32(np, "marvell,88pm860x-iset",
 					     &iset);
 			data->iset = PM8606_LED_CURRENT(iset);
+			of_node_put(np);
 			break;
 		}
 	}


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

* [PATCH 5/9] drm/tegra: dc: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
                   ` (3 preceding siblings ...)
  2015-10-24 14:42 ` [PATCH 4/9] leds: 88pm860x: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
       [not found]   ` <1445697755-26341-6-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
  2015-10-24 14:42 ` [PATCH 6/9] Bluetooth: btmrvl: " Julia Lawall
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Thomas Petazzoni, Alexandre Courbot, Terje Bergström,
	Jason Cooper, Stephen Warren, kernel-janitors, linux-kernel,
	dri-devel, Bjorn Helgaas, Andrew Lunn, linux-tegra,
	Russell King - ARM Linux

for_each_matching_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
local idexpression n;
expression e;
@@

 for_each_matching_node(n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  break;
)
   ...
 }
... when != n
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/tegra/dc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index b4af4ab..f0e6f37 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1945,8 +1945,10 @@ static int tegra_dc_parse_dt(struct tegra_dc *dc)
 		 * cases where only a single display controller is used.
 		 */
 		for_each_matching_node(np, tegra_dc_of_match) {
-			if (np = dc->dev->of_node)
+			if (np = dc->dev->of_node) {
+				of_node_put(np);
 				break;
+			}
 
 			value++;
 		}


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

* [PATCH 6/9] Bluetooth: btmrvl: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
                   ` (4 preceding siblings ...)
  2015-10-24 14:42 ` [PATCH 5/9] drm/tegra: dc: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-25 19:54   ` Marcel Holtmann
  2015-10-24 14:42 ` [PATCH 7/9] gpu: host1x: " Julia Lawall
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: kernel-janitors, Gustavo Padovan, Johan Hedberg, linux-bluetooth,
	linux-kernel, Russell King - ARM Linux, Thomas Petazzoni,
	Andrew Lunn, Bjorn Helgaas, Jason Cooper

for_each_compatible_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression e;
local idexpression n;
@@

 for_each_compatible_node(n, ...) {
   ... when != of_node_put(n)
       when != e = n
(
   return n;
|
+  of_node_put(n);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/bluetooth/btmrvl_main.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 6ba2286..6af9173 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -516,14 +516,17 @@ static int btmrvl_check_device_tree(struct btmrvl_private *priv)
 		ret = of_property_read_u8_array(dt_node, "btmrvl,cal-data",
 						cal_data + BT_CAL_HDR_LEN,
 						BT_CAL_DATA_SIZE);
-		if (ret)
+		if (ret) {
+			of_node_put(dt_node);
 			return ret;
+		}
 
 		BT_DBG("Use cal data from device tree");
 		ret = btmrvl_download_cal_data(priv, cal_data,
 					       BT_CAL_DATA_SIZE);
 		if (ret) {
 			BT_ERR("Fail to download calibrate data");
+			of_node_put(dt_node);
 			return ret;
 		}
 	}


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

* [PATCH 7/9] gpu: host1x: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
                   ` (5 preceding siblings ...)
  2015-10-24 14:42 ` [PATCH 6/9] Bluetooth: btmrvl: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-24 14:42 ` [PATCH 8/9] soc: ti: knav_qmss_queue: " Julia Lawall
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Thomas Petazzoni, Andrew Lunn, Terje Bergström,
	Jason Cooper, kernel-janitors, linux-kernel, dri-devel,
	Bjorn Helgaas, linux-tegra, Russell King - ARM Linux

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

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

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index 4a99c64..c1795a2 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -82,8 +82,10 @@ static int host1x_device_parse_dt(struct host1x_device *device,
 		if (of_match_node(driver->subdevs, np) &&
 		    of_device_is_available(np)) {
 			err = host1x_subdev_add(device, np);
-			if (err < 0)
+			if (err < 0) {
+				of_node_put(np);
 				return err;
+			}
 		}
 	}
 


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

* [PATCH 8/9] soc: ti: knav_qmss_queue: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
                   ` (6 preceding siblings ...)
  2015-10-24 14:42 ` [PATCH 7/9] gpu: host1x: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-24 14:42 ` [PATCH 9/9] pinctrl: at91: " Julia Lawall
  2015-10-26  8:48 ` [PATCH 0/9] " Jacek Anaszewski
  9 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: linux-arm-kernel

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/soc/ti/knav_qmss_queue.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 89789e2..6f3d12b 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -1074,6 +1074,7 @@ static int knav_queue_setup_regions(struct knav_device *kdev,
 		region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL);
 		if (!region) {
 			dev_err(dev, "out of memory allocating region\n");
+			of_node_put(child);
 			return -ENOMEM;
 		}
 
@@ -1373,6 +1374,7 @@ static int knav_queue_init_qmgrs(struct knav_device *kdev,
 		qmgr = devm_kzalloc(dev, sizeof(*qmgr), GFP_KERNEL);
 		if (!qmgr) {
 			dev_err(dev, "out of memory allocating qmgr\n");
+			of_node_put(child);
 			return -ENOMEM;
 		}
 
@@ -1450,6 +1452,7 @@ static int knav_queue_init_pdsps(struct knav_device *kdev,
 		pdsp = devm_kzalloc(dev, sizeof(*pdsp), GFP_KERNEL);
 		if (!pdsp) {
 			dev_err(dev, "out of memory allocating pdsp\n");
+			of_node_put(child);
 			return -ENOMEM;
 		}
 		pdsp->name = knav_queue_find_name(child);


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

* [PATCH 9/9] pinctrl: at91: add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
                   ` (7 preceding siblings ...)
  2015-10-24 14:42 ` [PATCH 8/9] soc: ti: knav_qmss_queue: " Julia Lawall
@ 2015-10-24 14:42 ` Julia Lawall
  2015-10-26  9:52   ` Ludovic Desroches
  2015-10-27 16:18   ` Linus Walleij
  2015-10-26  8:48 ` [PATCH 0/9] " Jacek Anaszewski
  9 siblings, 2 replies; 15+ messages in thread
From: Julia Lawall @ 2015-10-24 14:42 UTC (permalink / raw)
  To: linux-arm-kernel

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/pinctrl/pinctrl-at91.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index ce6e589..0d2fc0c 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1122,8 +1122,10 @@ static int at91_pinctrl_parse_functions(struct device_node *np,
 		func->groups[i] = child->name;
 		grp = &info->groups[grp_index++];
 		ret = at91_pinctrl_parse_groups(child, grp, info, i++);
-		if (ret)
+		if (ret) {
+			of_node_put(child);
 			return ret;
+		}
 	}
 
 	return 0;
@@ -1196,6 +1198,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev,
 		ret = at91_pinctrl_parse_functions(child, info, i++);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to parse function\n");
+			of_node_put(child);
 			return ret;
 		}
 	}


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

* Re: [PATCH 6/9] Bluetooth: btmrvl: add missing of_node_put
  2015-10-24 14:42 ` [PATCH 6/9] Bluetooth: btmrvl: " Julia Lawall
@ 2015-10-25 19:54   ` Marcel Holtmann
  0 siblings, 0 replies; 15+ messages in thread
From: Marcel Holtmann @ 2015-10-25 19:54 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Gustavo F. Padovan, Johan Hedberg,
	linux-bluetooth, linux-kernel, Russell King - ARM Linux,
	Thomas Petazzoni, Andrew Lunn, Bjorn Helgaas, Jason Cooper

Hi Julia,

> for_each_compatible_node performs an of_node_get on each iteration, so
> a break out of the loop requires an of_node_put.
> 
> A simplified version of the semantic patch that fixes this problem is as
> follows (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @@
> expression e;
> local idexpression n;
> @@
> 
> for_each_compatible_node(n, ...) {
>   ... when != of_node_put(n)
>       when != e = n
> (
>   return n;
> |
> +  of_node_put(n);
> ?  return ...;
> )
>   ...
> }
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
> drivers/bluetooth/btmrvl_main.c |    5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH 0/9] add missing of_node_put
  2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
                   ` (8 preceding siblings ...)
  2015-10-24 14:42 ` [PATCH 9/9] pinctrl: at91: " Julia Lawall
@ 2015-10-26  8:48 ` Jacek Anaszewski
  9 siblings, 0 replies; 15+ messages in thread
From: Jacek Anaszewski @ 2015-10-26  8:48 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-arm-kernel, kernel-janitors, linux-bluetooth, linux-leds,
	linux-kernel, dri-devel, linux-tegra, linux-gpio,
	Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn,
	Bjorn Helgaas, Jason Cooper

Hi Julia,

Patches 1-4 have been applied to the LED tree, thanks.

On 10/24/2015 04:42 PM, Julia Lawall wrote:
> The various for_each device_node iterators performs an of_node_get on each
> iteration, so a break out of the loop requires an of_node_put.
>
> The complete semantic patch that fixes this problem is
> (http://coccinelle.lip6.fr):
>
[...]

-- 
Best Regards,
Jacek Anaszewski

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

* Re: [PATCH 9/9] pinctrl: at91: add missing of_node_put
  2015-10-24 14:42 ` [PATCH 9/9] pinctrl: at91: " Julia Lawall
@ 2015-10-26  9:52   ` Ludovic Desroches
  2015-10-27 16:18   ` Linus Walleij
  1 sibling, 0 replies; 15+ messages in thread
From: Ludovic Desroches @ 2015-10-26  9:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 24, 2015 at 04:42:35PM +0200, Julia Lawall wrote:
> for_each_child_of_node performs an of_node_get on each iteration, so
> a break out of the loop requires an of_node_put.
> 
> A simplified version of the semantic patch that fixes this problem is as
> follows (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @@
> expression root,e;
> local idexpression child;
> @@
> 
>  for_each_child_of_node(root, child) {
>    ... when != of_node_put(child)
>        when != e = child
> (
>    return child;
> |
> +  of_node_put(child);
> ?  return ...;
> )
>    ...
>  }
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>

> 
> ---
>  drivers/pinctrl/pinctrl-at91.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
> index ce6e589..0d2fc0c 100644
> --- a/drivers/pinctrl/pinctrl-at91.c
> +++ b/drivers/pinctrl/pinctrl-at91.c
> @@ -1122,8 +1122,10 @@ static int at91_pinctrl_parse_functions(struct device_node *np,
>  		func->groups[i] = child->name;
>  		grp = &info->groups[grp_index++];
>  		ret = at91_pinctrl_parse_groups(child, grp, info, i++);
> -		if (ret)
> +		if (ret) {
> +			of_node_put(child);
>  			return ret;
> +		}
>  	}
>  
>  	return 0;
> @@ -1196,6 +1198,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev,
>  		ret = at91_pinctrl_parse_functions(child, info, i++);
>  		if (ret) {
>  			dev_err(&pdev->dev, "failed to parse function\n");
> +			of_node_put(child);
>  			return ret;
>  		}
>  	}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 9/9] pinctrl: at91: add missing of_node_put
  2015-10-24 14:42 ` [PATCH 9/9] pinctrl: at91: " Julia Lawall
  2015-10-26  9:52   ` Ludovic Desroches
@ 2015-10-27 16:18   ` Linus Walleij
  1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2015-10-27 16:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 24, 2015 at 4:42 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> for_each_child_of_node performs an of_node_get on each iteration, so
> a break out of the loop requires an of_node_put.
>
> A simplified version of the semantic patch that fixes this problem is as
> follows (http://coccinelle.lip6.fr):
>
> // <smpl>
> @@
> expression root,e;
> local idexpression child;
> @@
>
>  for_each_child_of_node(root, child) {
>    ... when != of_node_put(child)
>        when != e = child
> (
>    return child;
> |
> +  of_node_put(child);
> ?  return ...;
> )
>    ...
>  }
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Patch applied with Ludovic's ACK.

Yours,
Linus Walleij

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

* Re: [PATCH 5/9] drm/tegra: dc: add missing of_node_put
       [not found]   ` <1445697755-26341-6-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
@ 2015-12-14 13:35     ` Thierry Reding
  0 siblings, 0 replies; 15+ messages in thread
From: Thierry Reding @ 2015-12-14 13:35 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Terje Bergström,
	David Airlie, Stephen Warren, Alexandre Courbot,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Russell King - ARM Linux,
	Thomas Petazzoni, Andrew Lunn, Bjorn Helgaas, Jason Cooper

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

On Sat, Oct 24, 2015 at 04:42:31PM +0200, Julia Lawall wrote:
> for_each_matching_node performs an of_node_get on each iteration, so
> a break out of the loop requires an of_node_put.
> 
> A simplified version of the semantic patch that fixes this problem is as
> follows (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @@
> local idexpression n;
> expression e;
> @@
> 
>  for_each_matching_node(n,...) {
>    ...
> (
>    of_node_put(n);
> |
>    e = n
> |
> +  of_node_put(n);
> ?  break;
> )
>    ...
>  }
> ... when != n
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/gpu/drm/tegra/dc.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-12-14 13:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-24 14:42 [PATCH 0/9] add missing of_node_put Julia Lawall
2015-10-24 14:42 ` [PATCH 1/9] powerpc/powernv: " Julia Lawall
2015-10-24 14:42 ` [PATCH 2/9] leds: bcm6358: " Julia Lawall
2015-10-24 14:42 ` [PATCH 3/9] leds: bcm6328: " Julia Lawall
2015-10-24 14:42 ` [PATCH 4/9] leds: 88pm860x: " Julia Lawall
2015-10-24 14:42 ` [PATCH 5/9] drm/tegra: dc: " Julia Lawall
     [not found]   ` <1445697755-26341-6-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2015-12-14 13:35     ` Thierry Reding
2015-10-24 14:42 ` [PATCH 6/9] Bluetooth: btmrvl: " Julia Lawall
2015-10-25 19:54   ` Marcel Holtmann
2015-10-24 14:42 ` [PATCH 7/9] gpu: host1x: " Julia Lawall
2015-10-24 14:42 ` [PATCH 8/9] soc: ti: knav_qmss_queue: " Julia Lawall
2015-10-24 14:42 ` [PATCH 9/9] pinctrl: at91: " Julia Lawall
2015-10-26  9:52   ` Ludovic Desroches
2015-10-27 16:18   ` Linus Walleij
2015-10-26  8:48 ` [PATCH 0/9] " Jacek Anaszewski

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