diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2019-10-04 17:07:36 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2019-10-20 15:17:15 +0200 |
commit | ccc023a58175565b91f6d1996cde4dfe93b04808 (patch) | |
tree | a18ba92ecf4ad31cc80371dd23e5a61aa195194e /drivers/power | |
parent | Merge remote-tracking branch 'ib-ab8500-5.4-rc1' into for-next (diff) | |
download | linux-ccc023a58175565b91f6d1996cde4dfe93b04808.tar.xz linux-ccc023a58175565b91f6d1996cde4dfe93b04808.zip |
power: supply: ab8500: Cleanup probe in reverse order
It is logical to cleanup in probe's error path in reverse order to
previous actions. It also makes easier to add additional goto labels
within this error path.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/ab8500_btemp.c | 4 | ||||
-rw-r--r-- | drivers/power/supply/ab8500_fg.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index ad8c51ef8b8b..e9f536594770 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -1121,13 +1121,13 @@ static int ab8500_btemp_probe(struct platform_device *pdev) return ret; free_irq: - power_supply_unregister(di->btemp_psy); - /* We also have to free all successfully registered irqs */ for (i = i - 1; i >= 0; i--) { irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name); free_irq(irq, di); } + + power_supply_unregister(di->btemp_psy); free_btemp_wq: destroy_workqueue(di->btemp_wq); return ret; diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index f7909dfd3b61..015f4676e2ba 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -3219,15 +3219,15 @@ static int ab8500_fg_probe(struct platform_device *pdev) return ret; free_irq: - power_supply_unregister(di->fg_psy); - /* We also have to free all registered irqs */ + irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name); + free_irq(irq, di); for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq_th); i++) { irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name); free_irq(irq, di); } - irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name); - free_irq(irq, di); + + power_supply_unregister(di->fg_psy); free_inst_curr_wq: destroy_workqueue(di->fg_wq); return ret; |