diff mbox series

pwm: add missed clk_disable_unprepare() in zx_pwm_probe()

Message ID 1605702384-20911-1-git-send-email-zhangchangzhong@huawei.com
State Rejected
Headers show
Series pwm: add missed clk_disable_unprepare() in zx_pwm_probe() | expand

Commit Message

Zhang Changzhong Nov. 18, 2020, 12:26 p.m. UTC
Add the missing clk_disable_unprepare() before return from
zx_pwm_probe() in the error handling case.

Fixes: 4836193c435c ("pwm: Add ZTE ZX PWM device driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/pwm/pwm-zx.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Uwe Kleine-König Nov. 18, 2020, 12:37 p.m. UTC | #1
Hello,

On Wed, Nov 18, 2020 at 08:26:24PM +0800, Zhang Changzhong wrote:
> Add the missing clk_disable_unprepare() before return from
> zx_pwm_probe() in the error handling case.
> 
> Fixes: 4836193c435c ("pwm: Add ZTE ZX PWM device driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> ---
>  drivers/pwm/pwm-zx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pwm/pwm-zx.c b/drivers/pwm/pwm-zx.c
> index e2c21cc..3763ce5 100644
> --- a/drivers/pwm/pwm-zx.c
> +++ b/drivers/pwm/pwm-zx.c
> @@ -238,6 +238,7 @@ static int zx_pwm_probe(struct platform_device *pdev)
>  	ret = pwmchip_add(&zpc->chip);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
> +		clk_disable_unprepare(zpc->pclk);
>  		return ret;

This is already fixed in next with:

	a278e8771f42 ("pwm: zx: Add missing cleanup in error path")

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-zx.c b/drivers/pwm/pwm-zx.c
index e2c21cc..3763ce5 100644
--- a/drivers/pwm/pwm-zx.c
+++ b/drivers/pwm/pwm-zx.c
@@ -238,6 +238,7 @@  static int zx_pwm_probe(struct platform_device *pdev)
 	ret = pwmchip_add(&zpc->chip);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
+		clk_disable_unprepare(zpc->pclk);
 		return ret;
 	}