From: Tobias Jordan <kernel@cdqe.de>
To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
Jean-Jacques Hiblot <jjhiblot@ti.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Marek Behun <marek.behun@nic.cz>
Subject: [PATCH v2] leds: tlc591xx: fix leak of device node iterator
Date: Sat, 26 Sep 2020 02:51:17 +0200 [thread overview]
Message-ID: <20200926005117.GA32209@agrajag.zerfleddert.de> (raw)
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
next reply other threads:[~2020-09-26 0:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-26 0:51 Tobias Jordan [this message]
2020-09-26 1:24 ` [PATCH v2] leds: tlc591xx: fix leak of device node iterator Marek Behún
2020-09-30 17:11 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200926005117.GA32209@agrajag.zerfleddert.de \
--to=kernel@cdqe.de \
--cc=dmurphy@ti.com \
--cc=jjhiblot@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=marek.behun@nic.cz \
--cc=pavel@ucw.cz \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox