Skip to content

Commit

Permalink
power: supply: ab8500_charger: Bail out in case of error in 'ab8500_c…
Browse files Browse the repository at this point in the history
…harger_init_hw_registers()'

[ Upstream commit 09edcb6 ]

If an error occurs when we enable the backup battery charging, we should
go through the error handling path directly.

Before commit db43e6c ("ab8500-bm: Add usb power path support") this
was the case, but this commit has added some code between the last test and
the 'out' label.
So, in case of error, this added code is executed and the error may be
silently ignored.

Fix it by adding the missing 'goto out', as done in all other error
handling paths.

Fixes: db43e6c ("ab8500-bm: Add usb power path support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Christophe JAILLET authored and Greg Kroah-Hartman committed Mar 19, 2018
1 parent 4e074cd commit 3079e5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/power/supply/ab8500_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -3221,8 +3221,10 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
ret = abx500_mask_and_set_register_interruptible(di->dev,
AB8500_RTC, AB8500_RTC_CTRL_REG,
RTC_BUP_CH_ENA, RTC_BUP_CH_ENA);
if (ret < 0)
if (ret < 0) {
dev_err(di->dev, "%s mask and set failed\n", __func__);
goto out;
}

if (is_ab8540(di->parent)) {
ret = abx500_mask_and_set_register_interruptible(di->dev,
Expand Down

0 comments on commit 3079e5f

Please sign in to comment.