leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 22 Sep 2020 21:05:15 +0000 (23:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:22 +0000 (11:53 +0100)
commitad316987c4e451af60f82919a0e639d5d87e3132
tree3a595ce17e8b8fef5381b31079841f48da040e92
parent1687f01f0ea8ff2202b29886c97625f8e13fb48e
leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

[ Upstream commit 6d8d014c7dcf85a79da71ef586d06d03d2cae558 ]

In case of memory allocation failure, we must release some resources as
done in all other error handling paths of the function.

'goto child_out' instead of a direct return so that 'fwnode_handle_put()'
is called when we break out of a 'device_for_each_child_node' loop.

Fixes: 242b81170fb8 ("leds: lp50xx: Add the LP50XX family of the RGB LED driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/leds/leds-lp50xx.c