All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingi Kim <ingi2.kim@samsung.com>
To: robh+dt@kernel.org, j.anaszewski@samsung.com
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ingi Kim <ingi2.kim@samsung.com>
Subject: [PATCH] leds: ktd2692: Add missing of_node_put
Date: Tue, 10 Nov 2015 12:00:24 +0900	[thread overview]
Message-ID: <1447124424-16525-1-git-send-email-ingi2.kim@samsung.com> (raw)

The refcount of device_node increases after of_node_get() is called.
So, a break out of the loop requires of_node_put().

This patch adds missing of_node_put() when loop breaks.

Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
---
 drivers/leds/leds-ktd2692.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c
index feca07b..dbf37ce 100644
--- a/drivers/leds/leds-ktd2692.c
+++ b/drivers/leds/leds-ktd2692.c
@@ -332,21 +332,26 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
 				   &cfg->movie_max_microamp);
 	if (ret) {
 		dev_err(dev, "failed to parse led-max-microamp\n");
-		return ret;
+		goto err_parse_dt;
 	}
 
 	ret = of_property_read_u32(child_node, "flash-max-microamp",
 				   &cfg->flash_max_microamp);
 	if (ret) {
 		dev_err(dev, "failed to parse flash-max-microamp\n");
-		return ret;
+		goto err_parse_dt;
 	}
 
 	ret = of_property_read_u32(child_node, "flash-max-timeout-us",
 				   &cfg->flash_max_timeout);
-	if (ret)
+	if (ret) {
 		dev_err(dev, "failed to parse flash-max-timeout-us\n");
+		goto err_parse_dt;
+	}
+
+	return 0;
 
+err_parse_dt:
 	of_node_put(child_node);
 	return ret;
 }
-- 
2.0.5

             reply	other threads:[~2015-11-10  3:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10  3:00 Ingi Kim [this message]
2015-11-10 15:32 ` [PATCH] leds: ktd2692: Add missing of_node_put Rob Herring
2015-11-16 10:00 ` Jacek Anaszewski
2015-11-16 14:09   ` Rob Herring
2015-11-16 14:30     ` Jacek Anaszewski
2015-11-17  0:05       ` Ingi Kim

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=1447124424-16525-1-git-send-email-ingi2.kim@samsung.com \
    --to=ingi2.kim@samsung.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.