summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/sun4i-lradc-keys.c
diff options
context:
space:
mode:
authorNishka Dasgupta <nishkadg.linux@gmail.com>2019-07-12 09:49:16 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-07-12 09:56:03 +0300
commit071cfc43c875ee2e6ac2ae6929c2c153e1d13fe7 (patch)
treec9d7f9e6dfd41876f5bf35cf00a627d5f4024411 /drivers/input/keyboard/sun4i-lradc-keys.c
parent1976d7d200c5a32e72293a2ada36b7b7c9d6dd6e (diff)
downloadlinux-071cfc43c875ee2e6ac2ae6929c2c153e1d13fe7.tar.xz
Input: sun4i-lradc-keys - add of_node_put() before return
Each iteration of for_each_child_of_node puts the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the return in three places. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard/sun4i-lradc-keys.c')
-rw-r--r--drivers/input/keyboard/sun4i-lradc-keys.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c
index df3eec72a9b2..40903a07af99 100644
--- a/drivers/input/keyboard/sun4i-lradc-keys.c
+++ b/drivers/input/keyboard/sun4i-lradc-keys.c
@@ -207,18 +207,21 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev,
error = of_property_read_u32(pp, "channel", &channel);
if (error || channel != 0) {
dev_err(dev, "%pOFn: Inval channel prop\n", pp);
+ of_node_put(pp);
return -EINVAL;
}
error = of_property_read_u32(pp, "voltage", &map->voltage);
if (error) {
dev_err(dev, "%pOFn: Inval voltage prop\n", pp);
+ of_node_put(pp);
return -EINVAL;
}
error = of_property_read_u32(pp, "linux,code", &map->keycode);
if (error) {
dev_err(dev, "%pOFn: Inval linux,code prop\n", pp);
+ of_node_put(pp);
return -EINVAL;
}