Re: [PATCH] leds: ktd2692: Add missing of_node_put

From: Jacek Anaszewski
Date: Mon Nov 16 2015 - 05:00:59 EST

Hi Ingi, Rob,

With this patch we will be leaking of_node when parsing succeeds.
I think that "return 0" should be removed. I can remove it and apply,
provided that Rob's ack is still in force with this. Rob?

Best Regards,
Jacek Anaszewski

On 11/10/2015 04:00 AM, Ingi Kim wrote:
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 <>
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,
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",
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",
- if (ret)
+ if (ret) {
dev_err(dev, "failed to parse flash-max-timeout-us\n");
+ goto err_parse_dt;
+ }
+ return 0;

return ret;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at