Skip to content

Commit 0f5de2f

Browse files
Gao Chaosre
authored andcommitted
power: supply: ab8500_fg: add missing destroy_workqueue in ab8500_fg_probe
In ab8500_fg_probe, misses destroy_workqueue in error path, this patch fixes that. Fixes: 010ddb8 ("power: supply: ab8500_fg: Allocate wq in probe") Signed-off-by: Gao Chao <gaochao49@huawei.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent f2906aa commit 0f5de2f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/power/supply/ab8500_fg.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
31483148
ret = ab8500_fg_init_hw_registers(di);
31493149
if (ret) {
31503150
dev_err(dev, "failed to initialize registers\n");
3151+
destroy_workqueue(di->fg_wq);
31513152
return ret;
31523153
}
31533154

@@ -3159,6 +3160,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
31593160
di->fg_psy = devm_power_supply_register(dev, &ab8500_fg_desc, &psy_cfg);
31603161
if (IS_ERR(di->fg_psy)) {
31613162
dev_err(dev, "failed to register FG psy\n");
3163+
destroy_workqueue(di->fg_wq);
31623164
return PTR_ERR(di->fg_psy);
31633165
}
31643166

@@ -3174,8 +3176,10 @@ static int ab8500_fg_probe(struct platform_device *pdev)
31743176
/* Register primary interrupt handlers */
31753177
for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq); i++) {
31763178
irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name);
3177-
if (irq < 0)
3179+
if (irq < 0) {
3180+
destroy_workqueue(di->fg_wq);
31783181
return irq;
3182+
}
31793183

31803184
ret = devm_request_threaded_irq(dev, irq, NULL,
31813185
ab8500_fg_irq[i].isr,
@@ -3185,6 +3189,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
31853189
if (ret != 0) {
31863190
dev_err(dev, "failed to request %s IRQ %d: %d\n",
31873191
ab8500_fg_irq[i].name, irq, ret);
3192+
destroy_workqueue(di->fg_wq);
31883193
return ret;
31893194
}
31903195
dev_dbg(dev, "Requested %s IRQ %d: %d\n",
@@ -3200,13 +3205,15 @@ static int ab8500_fg_probe(struct platform_device *pdev)
32003205
ret = ab8500_fg_sysfs_init(di);
32013206
if (ret) {
32023207
dev_err(dev, "failed to create sysfs entry\n");
3208+
destroy_workqueue(di->fg_wq);
32033209
return ret;
32043210
}
32053211

32063212
ret = ab8500_fg_sysfs_psy_create_attrs(di);
32073213
if (ret) {
32083214
dev_err(dev, "failed to create FG psy\n");
32093215
ab8500_fg_sysfs_exit(di);
3216+
destroy_workqueue(di->fg_wq);
32103217
return ret;
32113218
}
32123219

0 commit comments

Comments
 (0)