* [PATCH] leds: lp55xx: fix device node iterator memory leaks
@ 2020-09-25 22:59 Tobias Jordan
2020-09-25 23:16 ` Marek Behun
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Jordan @ 2020-09-25 22:59 UTC (permalink / raw)
To: linux-leds, linux-kernel; +Cc: Pavel Machek, Dan Murphy, Jacek Anaszewski
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 <kernel@cdqe.de>
---
drivers/leds/leds-lp55xx-common.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index 56210f4ad919..f8b55cfd21ef 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_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++;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: lp55xx: fix device node iterator memory leaks
2020-09-25 22:59 [PATCH] leds: lp55xx: fix device node iterator memory leaks Tobias Jordan
@ 2020-09-25 23:16 ` Marek Behun
0 siblings, 0 replies; 2+ messages in thread
From: Marek Behun @ 2020-09-25 23:16 UTC (permalink / raw)
To: Tobias Jordan
Cc: linux-leds, linux-kernel, Pavel Machek, Dan Murphy,
Jacek Anaszewski
On Sat, 26 Sep 2020 00:59:05 +0200
Tobias Jordan <kernel@cdqe.de> wrote:
> 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 <kernel@cdqe.de>
> ---
> drivers/leds/leds-lp55xx-common.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
> index 56210f4ad919..f8b55cfd21ef 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_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++;
> }
>
This is already patched
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-25 23:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-25 22:59 [PATCH] leds: lp55xx: fix device node iterator memory leaks Tobias Jordan
2020-09-25 23:16 ` Marek Behun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox