projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
28598e2
)
led: qcom-lpg: Fix resource leaks in for_each_available_child_of_node() loops
author
Lu Hongfei
<luhongfei@vivo.com>
Thu, 25 May 2023 11:17:03 +0000
(19:17 +0800)
committer
Lee Jones
<lee@kernel.org>
Thu, 25 May 2023 12:01:45 +0000
(13:01 +0100)
Ensure child node references are decremented properly in the error path.
Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
Link:
https://lore.kernel.org/r/20230525111705.3055-1-luhongfei@vivo.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/rgb/leds-qcom-lpg.c
patch
|
blob
|
history
diff --git
a/drivers/leds/rgb/leds-qcom-lpg.c
b/drivers/leds/rgb/leds-qcom-lpg.c
index c9cea797a69779c3ac8e67e805d28344ba064cb4..20469200961ffc98ea5eed7b865fe83816d3c5df 100644
(file)
--- a/
drivers/leds/rgb/leds-qcom-lpg.c
+++ b/
drivers/leds/rgb/leds-qcom-lpg.c
@@
-1173,8
+1173,10
@@
static int lpg_add_led(struct lpg *lpg, struct device_node *np)
i = 0;
for_each_available_child_of_node(np, child) {
ret = lpg_parse_channel(lpg, child, &led->channels[i]);
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(child);
return ret;
+ }
info[i].color_index = led->channels[i]->color;
info[i].intensity = 0;
@@
-1352,8
+1354,10
@@
static int lpg_probe(struct platform_device *pdev)
for_each_available_child_of_node(pdev->dev.of_node, np) {
ret = lpg_add_led(lpg, np);
- if (ret)
+ if (ret) {
+ of_node_put(np);
return ret;
+ }
}
for (i = 0; i < lpg->num_channels; i++)