Linux LED subsystem development
 help / color / mirror / Atom feed
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>,
	"Marek Behún" <marek.behun@nic.cz>
Subject: [PATCH] leds: omnia: fix leak of device node iterator
Date: Sat, 26 Sep 2020 01:18:23 +0200	[thread overview]
Message-ID: <20200925231823.GA15759@agrajag.zerfleddert.de> (raw)

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

Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
Signed-off-by: Tobias Jordan <kernel@cdqe.de>
---
 drivers/leds/leds-turris-omnia.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
index bb23d8e16614..6c3d3d90f277 100644
--- a/drivers/leds/leds-turris-omnia.c
+++ b/drivers/leds/leds-turris-omnia.c
@@ -236,8 +236,10 @@ static int omnia_leds_probe(struct i2c_client *client,
 	led = &leds->leds[0];
 	for_each_available_child_of_node(np, child) {
 		ret = omnia_led_register(client, led, child);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(child);
 			return ret;
+		}
 
 		led += ret;
 	}
-- 
2.20.1


             reply	other threads:[~2020-09-25 23:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 23:18 Tobias Jordan [this message]
2020-09-25 23:29 ` [PATCH] leds: omnia: fix leak of device node iterator Marek Behun

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=20200925231823.GA15759@agrajag.zerfleddert.de \
    --to=kernel@cdqe.de \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=pavel@ucw.cz \
    /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