[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200925232644.GA17005@agrajag.zerfleddert.de>
Date: Sat, 26 Sep 2020 01:26:44 +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>,
Nikita Travkin <nikitos.tr@...il.com>
Subject: [PATCH] leds: aw2013: fix leak of device node iterator
In the error path of the for_each_available_child_of_node loop in
aw2013_probe_dt, add missing call to of_node_put to avoid leaking the
iterator.
Fixes: 59ea3c9faf32 ("leds: add aw2013 driver")
Signed-off-by: Tobias Jordan <kernel@...e.de>
---
drivers/leds/leds-aw2013.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c
index d709cc1f949e..8687ffa57a28 100644
--- a/drivers/leds/leds-aw2013.c
+++ b/drivers/leds/leds-aw2013.c
@@ -305,8 +305,10 @@ static int aw2013_probe_dt(struct aw2013 *chip)
ret = devm_led_classdev_register_ext(&chip->client->dev,
&led->cdev, &init_data);
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(child);
return ret;
+ }
i++;
}
--
2.20.1
Powered by blists - more mailing lists