diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2016-01-28 00:44:09 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-01-28 00:55:48 +0100 |
commit | 497e1b3f6b6d3cf2206d15687eb7bfa0ab0e968d (patch) | |
tree | 8cb7b434c2f1caa2e2b7fba962d7608f716d28d1 | |
parent | Input: sirfsoc-onkey - allow modular build (diff) | |
download | linux-497e1b3f6b6d3cf2206d15687eb7bfa0ab0e968d.tar.xz linux-497e1b3f6b6d3cf2206d15687eb7bfa0ab0e968d.zip |
Input: cap11xx - add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so
to break out of the loop an of_node_put is required.
Found using Coccinelle.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/keyboard/cap11xx.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index 378db10001df..4401be225d64 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -304,8 +304,10 @@ static int cap11xx_init_leds(struct device *dev, led->cdev.brightness = LED_OFF; error = of_property_read_u32(child, "reg", ®); - if (error != 0 || reg >= num_leds) + if (error != 0 || reg >= num_leds) { + of_node_put(child); return -EINVAL; + } led->reg = reg; led->priv = priv; @@ -313,8 +315,10 @@ static int cap11xx_init_leds(struct device *dev, INIT_WORK(&led->work, cap11xx_led_work); error = devm_led_classdev_register(dev, &led->cdev); - if (error) + if (error) { + of_node_put(child); return error; + } priv->num_leds++; led++; |