Commit 1945063e authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Bartosz Golaszewski

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: 757642f9 ("gpio: mvebu: Add limited PWM support")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 5a7adc6c
......@@ -874,7 +874,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
spin_lock_init(&mvpwm->lock);
return pwmchip_add(&mvpwm->chip);
return devm_pwmchip_add(dev, &mvpwm->chip);
}
#ifdef CONFIG_DEBUG_FS
......@@ -1243,8 +1243,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
if (!mvchip->domain) {
dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
mvchip->chip.label);
err = -ENODEV;
goto err_pwm;
return -ENODEV;
}
err = irq_alloc_domain_generic_chips(
......@@ -1296,9 +1295,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
err_domain:
irq_domain_remove(mvchip->domain);
err_pwm:
pwmchip_remove(&mvchip->mvpwm->chip);
return err;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment