From: Nishka Dasgupta Date: Fri, 12 Jul 2019 06:49:16 +0000 (-0700) Subject: Input: sun4i-lradc-keys - add of_node_put() before return X-Git-Tag: v5.4-rc1~109^2~13^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=071cfc43c875ee2e6ac2ae6929c2c153e1d13fe7;p=platform%2Fkernel%2Flinux-rpi.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 Signed-off-by: Dmitry Torokhov --- 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; }