OSDN Git Service

leds: netxbig: Add of_node_put() in netxbig_leds_get_of_pdata()
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Mon, 29 Jul 2019 06:53:56 +0000 (12:23 +0530)
committerJacek Anaszewski <jacek.anaszewski@gmail.com>
Mon, 29 Jul 2019 19:12:54 +0000 (21:12 +0200)
commitaf7b65054952a9898534d966f2e548d7692b7016
tree3e53f21709d35d0708590ccff92031408df3620c
parent156189a6d7a797d6fa0b13dd6b4f32b11d234a99
leds: netxbig: Add of_node_put() in netxbig_leds_get_of_pdata()

The variable gpio_ext_np in the function netxbig_leds_get_of_pdata takes
the value returned by of_parse_phandle; hence, it must be put in order
to prevent a memory leak. Add an of_node_put for gpio_ext_np before a
return statement, and move a pre-existing of_node_put statement to right
after the last usage of this variable.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
drivers/leds/leds-netxbig.c