From 2c67756254349d2b4a1af92c846e32f7e15fae89 Mon Sep 17 00:00:00 2001 From: Marek BehĂșn Date: Fri, 18 Sep 2020 00:32:57 +0200 Subject: leds: various: fix OF node leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix OF node leaks by calling of_node_put in for_each_available_child_of_node when the cycle breaks or returns. Signed-off-by: Marek BehĂșn Cc: Nikita Travkin Cc: Milo Kim Cc: Dan Murphy Signed-off-by: Pavel Machek Not-for-stable: untested, theoretical, insignificant leaks --- drivers/leds/leds-turris-omnia.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/leds/leds-turris-omnia.c') diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c index ea7da8517220..117976cf75c8 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; } -- cgit v1.2.3