linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe()
@ 2021-05-10  9:57 Andy Shevchenko
  2021-05-10 10:41 ` Brian Masney
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-05-10  9:57 UTC (permalink / raw)
  To: Lee Jones, dri-devel, linux-fbdev, linux-kernel
  Cc: Daniel Thompson, Jingoo Han, Andy Shevchenko, Brian Masney, Dan Murphy

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 <masneyb@onstation.org>
Cc: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe()
  2021-05-10  9:57 [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe() Andy Shevchenko
@ 2021-05-10 10:41 ` Brian Masney
  2021-05-13 10:37 ` Daniel Thompson
  2021-05-19 14:33 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Brian Masney @ 2021-05-10 10:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lee Jones, dri-devel, linux-fbdev, linux-kernel, Daniel Thompson,
	Jingoo Han, Dan Murphy

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 <masneyb@onstation.org>
> Cc: Dan Murphy <dmurphy@ti.com>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Reviewed-by: Brian Masney <masneyb@onstation.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe()
  2021-05-10  9:57 [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe() Andy Shevchenko
  2021-05-10 10:41 ` Brian Masney
@ 2021-05-13 10:37 ` Daniel Thompson
  2021-05-19 14:33 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Thompson @ 2021-05-13 10:37 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lee Jones, dri-devel, linux-fbdev, linux-kernel, Jingoo Han,
	Brian Masney, Dan Murphy

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 <masneyb@onstation.org>
> Cc: Dan Murphy <dmurphy@ti.com>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


> ---
>  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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe()
  2021-05-10  9:57 [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe() Andy Shevchenko
  2021-05-10 10:41 ` Brian Masney
  2021-05-13 10:37 ` Daniel Thompson
@ 2021-05-19 14:33 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2021-05-19 14:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: dri-devel, linux-fbdev, linux-kernel, Daniel Thompson,
	Jingoo Han, Brian Masney, Dan Murphy

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 <masneyb@onstation.org>
> Cc: Dan Murphy <dmurphy@ti.com>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-19 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  9:57 [PATCH v1 1/1] backlight: lm3630a_bl: Put fwnode in error case during ->probe() Andy Shevchenko
2021-05-10 10:41 ` Brian Masney
2021-05-13 10:37 ` Daniel Thompson
2021-05-19 14:33 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).