backlight: lm3630a_bl: Put fwnode in error case during ->probe()

Started by Andy Shevchenko on May 10, 2021 · 4 messages from 4 authors · Last reply May 19, 2021

Subsystems (3)

Maintainers (5)

Show 1 more
STALE2002d

open the first message on its own page

Message details and related content
device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Fixes: 8fbce8efe15cd ("backlight: lm3630a: Add firmware node support")
Cc: Brian Masney <redacted>
Cc: Dan Murphy <redacted>
Signed-off-by: Andy Shevchenko <redacted>
---
 drivers/video/backlight/lm3630a_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index e88a2b0e5904..662029d6a3dc 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -482,8 +482,10 @@ static int lm3630a_parse_node(struct lm3630a_chip *pchip,
 
 	device_for_each_child_node(pchip->dev, node) {
 		ret = lm3630a_parse_bank(pdata, node, &seen_led_sources);
-		if (ret)
+		if (ret) {
+			fwnode_handle_put(node);
 			return ret;
+		}
 	}
 
 	return ret;
-- 
2.31.1
Message details and related content
On Mon, May 10, 2021 at 12:57:16PM +0300, Andy Shevchenko wrote:
device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Fixes: 8fbce8efe15cd ("backlight: lm3630a: Add firmware node support")
Cc: Brian Masney <redacted>
Cc: Dan Murphy <redacted>
Signed-off-by: Andy Shevchenko <redacted>
Reviewed-by: Brian Masney <redacted>
Message details and related content
On Mon, May 10, 2021 at 12:57:16PM +0300, Andy Shevchenko wrote:
device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Fixes: 8fbce8efe15cd ("backlight: lm3630a: Add firmware node support")
Cc: Brian Masney <redacted>
Cc: Dan Murphy <redacted>
Signed-off-by: Andy Shevchenko <redacted>
Reviewed-by: Daniel Thompson <redacted>

quoted hunk
---
 drivers/video/backlight/lm3630a_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index e88a2b0e5904..662029d6a3dc 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -482,8 +482,10 @@ static int lm3630a_parse_node(struct lm3630a_chip *pchip,
 
 	device_for_each_child_node(pchip->dev, node) {
 		ret = lm3630a_parse_bank(pdata, node, &seen_led_sources);
-		if (ret)
+		if (ret) {
+			fwnode_handle_put(node);
 			return ret;
+		}
 	}
 
 	return ret;
-- 
2.31.1
Message details and related content
On Mon, 10 May 2021, Andy Shevchenko wrote:
device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Fixes: 8fbce8efe15cd ("backlight: lm3630a: Add firmware node support")
Cc: Brian Masney <redacted>
Cc: Dan Murphy <redacted>
Signed-off-by: Andy Shevchenko <redacted>
---
 drivers/video/backlight/lm3630a_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help