linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: ab8500: Fix the error handling path of ab8500_charger_probe()
@ 2021-12-28 20:43 Christophe JAILLET
  2022-01-02  6:43 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2021-12-28 20:43 UTC (permalink / raw)
  To: sre, linus.walleij
  Cc: linux-pm, linux-kernel, kernel-janitors, Christophe JAILLET

Since the commit below, ab8500_bm_of_remove() needs to be called after a
successful ab8500_bm_of_probe() call.
This commit has only updated the remove function.

Fix the error handling path of the probe the same way.

Fixes: 6252c706cdb0 ("power: supply: ab8500: Standardize operating temperature")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
For a better understanding, maybe, the ab8500_bm_of_remove() call in the
remove function should be moved at the bottom of the function, so that
resources are freed in reverse order than allocation.
I've not looked in details if the position of this call was important or
not, though.
---
 drivers/power/supply/ab8500_charger.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c
index db7457064a17..ce074c018dcb 100644
--- a/drivers/power/supply/ab8500_charger.c
+++ b/drivers/power/supply/ab8500_charger.c
@@ -3665,11 +3665,13 @@ static int ab8500_charger_probe(struct platform_device *pdev)
 	}
 	if (!match) {
 		dev_err(dev, "no matching components\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto remove_ab8500_bm;
 	}
 	if (IS_ERR(match)) {
 		dev_err(dev, "could not create component match\n");
-		return PTR_ERR(match);
+		ret = PTR_ERR(match);
+		goto remove_ab8500_bm;
 	}
 
 	/* Notifier for external charger enabling */
@@ -3710,6 +3712,8 @@ static int ab8500_charger_probe(struct platform_device *pdev)
 	if (!di->ac_chg.enabled)
 		blocking_notifier_chain_unregister(
 			&charger_notifier_list, &charger_nb);
+remove_ab8500_bm:
+	ab8500_bm_of_remove(di->usb_chg.psy, di->bm);
 	return ret;
 }
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: supply: ab8500: Fix the error handling path of ab8500_charger_probe()
  2021-12-28 20:43 [PATCH] power: supply: ab8500: Fix the error handling path of ab8500_charger_probe() Christophe JAILLET
@ 2022-01-02  6:43 ` Linus Walleij
  2022-01-03 17:40   ` Sebastian Reichel
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2022-01-02  6:43 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: sre, linux-pm, linux-kernel, kernel-janitors

On Tue, Dec 28, 2021 at 9:43 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:

> Since the commit below, ab8500_bm_of_remove() needs to be called after a
> successful ab8500_bm_of_probe() call.
> This commit has only updated the remove function.
>
> Fix the error handling path of the probe the same way.
>
> Fixes: 6252c706cdb0 ("power: supply: ab8500: Standardize operating temperature")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Nice catch,
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: supply: ab8500: Fix the error handling path of ab8500_charger_probe()
  2022-01-02  6:43 ` Linus Walleij
@ 2022-01-03 17:40   ` Sebastian Reichel
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2022-01-03 17:40 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Christophe JAILLET, linux-pm, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

Hi,

On Sun, Jan 02, 2022 at 07:43:55AM +0100, Linus Walleij wrote:
> On Tue, Dec 28, 2021 at 9:43 PM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
> 
> > Since the commit below, ab8500_bm_of_remove() needs to be called after a
> > successful ab8500_bm_of_probe() call.
> > This commit has only updated the remove function.
> >
> > Fix the error handling path of the probe the same way.
> >
> > Fixes: 6252c706cdb0 ("power: supply: ab8500: Standardize operating temperature")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Nice catch,
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-03 17:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 20:43 [PATCH] power: supply: ab8500: Fix the error handling path of ab8500_charger_probe() Christophe JAILLET
2022-01-02  6:43 ` Linus Walleij
2022-01-03 17:40   ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).