linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: aw2013: fix leak of device node iterator
@ 2020-09-25 23:26 Tobias Jordan
  2020-09-30 17:10 ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Jordan @ 2020-09-25 23:26 UTC (permalink / raw)
  To: linux-leds, linux-kernel; +Cc: Pavel Machek, Dan Murphy, Nikita Travkin

In the error path of the for_each_available_child_of_node loop in
aw2013_probe_dt, add missing call to of_node_put to avoid leaking the
iterator.

Fixes: 59ea3c9faf32 ("leds: add aw2013 driver")
Signed-off-by: Tobias Jordan <kernel@cdqe.de>
---
 drivers/leds/leds-aw2013.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c
index d709cc1f949e..8687ffa57a28 100644
--- a/drivers/leds/leds-aw2013.c
+++ b/drivers/leds/leds-aw2013.c
@@ -305,8 +305,10 @@ static int aw2013_probe_dt(struct aw2013 *chip)
 
 		ret = devm_led_classdev_register_ext(&chip->client->dev,
 						     &led->cdev, &init_data);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(child);
 			return ret;
+		}
 
 		i++;
 	}
-- 
2.20.1


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

* Re: [PATCH] leds: aw2013: fix leak of device node iterator
  2020-09-25 23:26 [PATCH] leds: aw2013: fix leak of device node iterator Tobias Jordan
@ 2020-09-30 17:10 ` Pavel Machek
  2020-09-30 20:44   ` Tobias Jordan
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2020-09-30 17:10 UTC (permalink / raw)
  To: Tobias Jordan; +Cc: linux-leds, linux-kernel, Dan Murphy, Nikita Travkin

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

Hi!

> In the error path of the for_each_available_child_of_node loop in
> aw2013_probe_dt, add missing call to of_node_put to avoid leaking the
> iterator.
> 
> Fixes: 59ea3c9faf32 ("leds: add aw2013 driver")
> Signed-off-by: Tobias Jordan <kernel@cdqe.de>

This failed to apply to my -for-next tree.

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

* Re: [PATCH] leds: aw2013: fix leak of device node iterator
  2020-09-30 17:10 ` Pavel Machek
@ 2020-09-30 20:44   ` Tobias Jordan
  0 siblings, 0 replies; 3+ messages in thread
From: Tobias Jordan @ 2020-09-30 20:44 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-leds, linux-kernel, Dan Murphy, Nikita Travkin

On 2020-09-30 19:10, Pavel Machek wrote:
Hi Pavel,

> > In the error path of the for_each_available_child_of_node loop in
> > aw2013_probe_dt, add missing call to of_node_put to avoid leaking
> > the iterator.
> > 
> > Fixes: 59ea3c9faf32 ("leds: add aw2013 driver")
> > Signed-off-by: Tobias Jordan <kernel@cdqe.de>  
> 
> This failed to apply to my -for-next tree.

Yes, it turns out this had been fixed by Marek already one day
before I submitted my patch (in commit 2c6775625434) and I didn't
notice that. So nothing to do there, sorry for the inconvenience.

Best regards,

Tobias

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 23:26 [PATCH] leds: aw2013: fix leak of device node iterator Tobias Jordan
2020-09-30 17:10 ` Pavel Machek
2020-09-30 20:44   ` Tobias Jordan

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