Skip to content

Commit 1945063

Browse files
Uwe Kleine-KönigBartosz Golaszewski
authored andcommitted
gpio: mvebu: Make use of devm_pwmchip_add
This allows to get rid of a call to pwmchip_remove() in the error path. There is no .remove function for this driver, so this change fixes a resource leak when a gpio-mvebu device is unbound. Fixes: 757642f ("gpio: mvebu: Add limited PWM support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 5a7adc6 commit 1945063

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/gpio/gpio-mvebu.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
874874

875875
spin_lock_init(&mvpwm->lock);
876876

877-
return pwmchip_add(&mvpwm->chip);
877+
return devm_pwmchip_add(dev, &mvpwm->chip);
878878
}
879879

880880
#ifdef CONFIG_DEBUG_FS
@@ -1243,8 +1243,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12431243
if (!mvchip->domain) {
12441244
dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
12451245
mvchip->chip.label);
1246-
err = -ENODEV;
1247-
goto err_pwm;
1246+
return -ENODEV;
12481247
}
12491248

12501249
err = irq_alloc_domain_generic_chips(
@@ -1296,9 +1295,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12961295

12971296
err_domain:
12981297
irq_domain_remove(mvchip->domain);
1299-
err_pwm:
1300-
pwmchip_remove(&mvchip->mvpwm->chip);
1301-
13021298
return err;
13031299
}
13041300

0 commit comments

Comments
 (0)