Commit 071cfc43 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Dmitry Torokhov

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: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 1976d7d2
...@@ -207,18 +207,21 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev, ...@@ -207,18 +207,21 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev,
error = of_property_read_u32(pp, "channel", &channel); error = of_property_read_u32(pp, "channel", &channel);
if (error || channel != 0) { if (error || channel != 0) {
dev_err(dev, "%pOFn: Inval channel prop\n", pp); dev_err(dev, "%pOFn: Inval channel prop\n", pp);
of_node_put(pp);
return -EINVAL; return -EINVAL;
} }
error = of_property_read_u32(pp, "voltage", &map->voltage); error = of_property_read_u32(pp, "voltage", &map->voltage);
if (error) { if (error) {
dev_err(dev, "%pOFn: Inval voltage prop\n", pp); dev_err(dev, "%pOFn: Inval voltage prop\n", pp);
of_node_put(pp);
return -EINVAL; return -EINVAL;
} }
error = of_property_read_u32(pp, "linux,code", &map->keycode); error = of_property_read_u32(pp, "linux,code", &map->keycode);
if (error) { if (error) {
dev_err(dev, "%pOFn: Inval linux,code prop\n", pp); dev_err(dev, "%pOFn: Inval linux,code prop\n", pp);
of_node_put(pp);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment