linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] leds: tlc591xx: fix leak of device node iterator
@ 2020-09-26  0:51 Tobias Jordan
  2020-09-26  1:24 ` Marek Behún
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Jordan @ 2020-09-26  0:51 UTC (permalink / raw)
  To: linux-leds, linux-kernel
  Cc: Pavel Machek, Dan Murphy, Jean-Jacques Hiblot, Tomi Valkeinen,
	Marek Behun

In one of the error paths of the for_each_child_of_node loop in
tlc591xx_probe, add missing call to of_node_put.

Fixes: 1ab4531ad132 ("leds: tlc591xx: simplify driver by using the
managed led API")

Signed-off-by: Tobias Jordan <kernel@cdqe.de>
---
v2: rebased to Pavel's for-next branch

 drivers/leds/leds-tlc591xx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
index f24271337bd8..5b9dfdf743ec 100644
--- a/drivers/leds/leds-tlc591xx.c
+++ b/drivers/leds/leds-tlc591xx.c
@@ -205,10 +205,12 @@ tlc591xx_probe(struct i2c_client *client,
 		led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS;
 		err = devm_led_classdev_register_ext(dev, &led->ldev,
 						     &init_data);
-		if (err < 0)
+		if (err < 0) {
+			of_node_put(child);
 			return dev_err_probe(dev, err,
 					     "couldn't register LED %s\n",
 					     led->ldev.name);
+		}
 	}
 	return 0;
 }
-- 
2.20.1


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

* Re: [PATCH v2] leds: tlc591xx: fix leak of device node iterator
  2020-09-26  0:51 [PATCH v2] leds: tlc591xx: fix leak of device node iterator Tobias Jordan
@ 2020-09-26  1:24 ` Marek Behún
  2020-09-30 17:11   ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Behún @ 2020-09-26  1:24 UTC (permalink / raw)
  To: Tobias Jordan
  Cc: linux-leds, linux-kernel, Pavel Machek, Dan Murphy,
	Jean-Jacques Hiblot, Tomi Valkeinen

On Sat, 26 Sep 2020 02:51:17 +0200
Tobias Jordan <kernel@cdqe.de> wrote:

> In one of the error paths of the for_each_child_of_node loop in
> tlc591xx_probe, add missing call to of_node_put.
> 
> Fixes: 1ab4531ad132 ("leds: tlc591xx: simplify driver by using the
> managed led API")
> 
> Signed-off-by: Tobias Jordan <kernel@cdqe.de>
> ---
> v2: rebased to Pavel's for-next branch
> 
>  drivers/leds/leds-tlc591xx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
> index f24271337bd8..5b9dfdf743ec 100644
> --- a/drivers/leds/leds-tlc591xx.c
> +++ b/drivers/leds/leds-tlc591xx.c
> @@ -205,10 +205,12 @@ tlc591xx_probe(struct i2c_client *client,
>  		led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS;
>  		err = devm_led_classdev_register_ext(dev, &led->ldev,
>  						     &init_data);
> -		if (err < 0)
> +		if (err < 0) {
> +			of_node_put(child);
>  			return dev_err_probe(dev, err,
>  					     "couldn't register LED %s\n",
>  					     led->ldev.name);
> +		}
>  	}
>  	return 0;
>  }

Reviewed-by: Marek Behún <kabel@kernel.org>

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

* Re: [PATCH v2] leds: tlc591xx: fix leak of device node iterator
  2020-09-26  1:24 ` Marek Behún
@ 2020-09-30 17:11   ` Pavel Machek
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2020-09-30 17:11 UTC (permalink / raw)
  To: Marek Behún
  Cc: Tobias Jordan, linux-leds, linux-kernel, Dan Murphy,
	Jean-Jacques Hiblot, Tomi Valkeinen

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

Hi!

> > In one of the error paths of the for_each_child_of_node loop in
> > tlc591xx_probe, add missing call to of_node_put.
> > 
> > Fixes: 1ab4531ad132 ("leds: tlc591xx: simplify driver by using the
> > managed led API")
> > 
> > Signed-off-by: Tobias Jordan <kernel@cdqe.de>
> 
> Reviewed-by: Marek Behún <kabel@kernel.org>

Thanks, applied.

Marek: Thanks for review. If I can get you to trim parts not
interesting for the email, I'll be even happier.

:-).

Best regards,

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2020-09-30 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-26  0:51 [PATCH v2] leds: tlc591xx: fix leak of device node iterator Tobias Jordan
2020-09-26  1:24 ` Marek Behún
2020-09-30 17:11   ` Pavel Machek

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