mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
1976d7d200
commit
071cfc43c8
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue