diff options
author | Marek BehĂșn <marek.behun@nic.cz> | 2020-09-18 00:32:57 +0200 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 2020-09-26 21:56:39 +0200 |
commit | 2c67756254349d2b4a1af92c846e32f7e15fae89 (patch) | |
tree | 6c2344683d2a4d93ed9c9d8fee7708858a2a6f4b /drivers/leds/leds-lp55xx-common.c | |
parent | leds: various: use only available OF children (diff) | |
download | linux-2c67756254349d2b4a1af92c846e32f7e15fae89.tar.xz linux-2c67756254349d2b4a1af92c846e32f7e15fae89.zip |
leds: various: fix OF node leaks
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 <marek.behun@nic.cz>
Cc: Nikita Travkin <nikitos.tr@gmail.com>
Cc: Milo Kim <milo.kim@ti.com>
Cc: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Not-for-stable: untested, theoretical, insignificant leaks
Diffstat (limited to 'drivers/leds/leds-lp55xx-common.c')
-rw-r--r-- | drivers/leds/leds-lp55xx-common.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 50f7f5b87463..81de1346bf5d 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -614,8 +614,10 @@ static int lp55xx_parse_multi_led(struct device_node *np, for_each_available_child_of_node(np, child) { ret = lp55xx_parse_multi_led_child(child, cfg, child_number, num_colors); - if (ret) + if (ret) { + of_node_put(child); return ret; + } num_colors++; } @@ -681,8 +683,10 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, for_each_available_child_of_node(np, child) { ret = lp55xx_parse_logical_led(child, cfg, i); - if (ret) + if (ret) { + of_node_put(child); return ERR_PTR(-EINVAL); + } i++; } |