[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200925231823.GA15759@agrajag.zerfleddert.de>
Date: Sat, 26 Sep 2020 01:18:23 +0200
From: Tobias Jordan <kernel@...e.de>
To: linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
Marek BehĂșn <marek.behun@....cz>
Subject: [PATCH] leds: omnia: fix leak of device node iterator
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@...e.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
Powered by blists - more mailing lists