power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 9 May 2020 08:23:23 +0000 (10:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:50:25 +0000 (17:50 +0200)
commitad8b5b5faf9d18b3af160525e1ea638851f66c4a
treebc2df97ae3b59aeb2deaeb9b357fc55cc2de6581
parentc1bcf01aea0ec11c8cd0ffcc43591429dd67fbf3
power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()'

[ Upstream commit 934ed3847a4ebc75b655659c4d2349ba4337941c ]

In the probe function, in case of error, resources allocated in
'lp8788_setup_adc_channel()' must be released.

This can be achieved easily by using the devm_ variant of
'iio_channel_get()'.
This has the extra benefit to simplify the remove function and to axe the
'lp8788_release_adc_channel()' function which is now useless.

Fixes: 98a276649358 ("power_supply: Add new lp8788 charger driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/power/supply/lp8788-charger.c