public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: omnia: fix leak of device node iterator
@ 2020-09-25 23:18 Tobias Jordan
  2020-09-25 23:29 ` Marek Behun
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Jordan @ 2020-09-25 23:18 UTC (permalink / raw)
  To: linux-leds, linux-kernel; +Cc: Pavel Machek, Dan Murphy, Marek Behún

In the error path of the for_each_available_child_of_node loop in
omnia_leds_probe, add missing call to of_node_put to fix leaking the
iterator.

Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
Signed-off-by: Tobias Jordan <kernel@cdqe.de>
---
 drivers/leds/leds-turris-omnia.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
index bb23d8e16614..6c3d3d90f277 100644
--- a/drivers/leds/leds-turris-omnia.c
+++ b/drivers/leds/leds-turris-omnia.c
@@ -236,8 +236,10 @@ static int omnia_leds_probe(struct i2c_client *client,
 	led = &leds->leds[0];
 	for_each_available_child_of_node(np, child) {
 		ret = omnia_led_register(client, led, child);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(child);
 			return ret;
+		}
 
 		led += ret;
 	}
-- 
2.20.1


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

* Re: [PATCH] leds: omnia: fix leak of device node iterator
  2020-09-25 23:18 [PATCH] leds: omnia: fix leak of device node iterator Tobias Jordan
@ 2020-09-25 23:29 ` Marek Behun
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Behun @ 2020-09-25 23:29 UTC (permalink / raw)
  To: Tobias Jordan; +Cc: linux-leds, linux-kernel, Pavel Machek, Dan Murphy

Already fixed in Pavel's for-next
https://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git/commit/?h=for-next&id=62aa40d0e907849d740ceba2a7f6bcc88896699f

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

end of thread, other threads:[~2020-09-25 23:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-25 23:18 [PATCH] leds: omnia: fix leak of device node iterator Tobias Jordan
2020-09-25 23:29 ` Marek Behun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox