leds: lp55xx: fix device node iterator memory leaks
PATCH 1/1 leds: lp55xx: fix device node iterator memory leaks
Fix error paths in for_each_child_of_node loops that were missing an of_node_put call.
Fixes 92a81562e695 ("leds: lp55xx: Add multicolor framework support to
lp55xx")
Signed-off-by Tobias Jordan <[email protected]>
--- drivers/leds/leds-lp55xx-common.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/leds/leds-lp55xx-common.c +6 -2
@@ -614,8 +614,10 @@ static int lp55xx_parse_multi_led(struct device_node *np,for_each_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_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++; }
Signature · 1 line
2.20.1
Quoted 28 lines · On Sat, 26 Sep 2020 00:59:05 +0200 Tobias Jordan <[email protected]> wrote:
Fix error paths in
for_each_child_of_nodeloops that were missing anof_node_putcall.Fixes 92a81562e695 ("leds: lp55xx: Add multicolor framework support tolp55xx")
Signed-off-by Tobias Jordan <[email protected]>--- drivers/leds/leds-lp55xx-common.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/leds/leds-lp55xx-common.c +3
-1@@ -614,8 +614,10 @@ static int lp55xx_parse_multi_led(struct device_node *np,for_each_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,
drivers/leds/leds-lp55xx-common.c struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, · line 692
Quoted 10 lines
drivers/leds/leds-lp55xx-common.c +3
-1for_each_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++; }
This is already patched