leds: ktd2692: Add missing of_node_put
authorIngi Kim <ingi2.kim@samsung.com>
Mon, 16 Nov 2015 14:19:55 +0000 (15:19 +0100)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Mon, 4 Jan 2016 08:57:37 +0000 (09:57 +0100)
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>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
drivers/leds/leds-ktd2692.c

index abd04bfbbdf9cd803ba804d876e9252649c1ff7d..bf23ba191ad06857a3a3e1a7ab8e2725d910262f 100644 (file)
@@ -306,21 +306,24 @@ 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;
+       }
 
+err_parse_dt:
        of_node_put(child_node);
        return ret;
 }