leds: aat1290: Add missing of_node_put
authorJacek Anaszewski <j.anaszewski@samsung.com>
Wed, 25 Nov 2015 08:22:19 +0000 (09:22 +0100)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Mon, 4 Jan 2016 08:57:38 +0000 (09:57 +0100)
The refcount of device_node increases after of_get_next_available_child()
is called. Make sure it is decremented also in case of DT parsing error.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
drivers/leds/leds-aat1290.c

index f2259308b92ebc61c705e08d60244de104ad91ea..def3cf9f7e9287d630ea5d9712a8323225b9b7a1 100644 (file)
@@ -275,7 +275,7 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
        if (ret < 0) {
                dev_err(dev,
                        "flash-max-microamp DT property missing\n");
-               return ret;
+               goto err_parse_dt;
        }
 
        ret = of_property_read_u32(child_node, "flash-max-timeout-us",
@@ -283,13 +283,14 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
        if (ret < 0) {
                dev_err(dev,
                        "flash-max-timeout-us DT property missing\n");
-               return ret;
+               goto err_parse_dt;
        }
 
-       of_node_put(child_node);
-
        *sub_node = child_node;
 
+err_parse_dt:
+       of_node_put(child_node);
+
        return ret;
 }