diff mbox series

[v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume

Message ID 20201103120743.110662-1-miaoqinglang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume | expand

Commit Message

Qinglang Miao Nov. 3, 2020, 12:07 p.m. UTC
Fix the missing clk_disable_unprepare() of info->pclk
before return from rockchip_saradc_resume in the error
handling case when fails to prepare and enable info->clk.

Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc")
Suggested-by:Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
v2: remove useless braces because early return is pointless.

 drivers/iio/adc/rockchip_saradc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Nov. 8, 2020, 3:41 p.m. UTC | #1
On Tue, 3 Nov 2020 20:07:43 +0800
Qinglang Miao <miaoqinglang@huawei.com> wrote:

> Fix the missing clk_disable_unprepare() of info->pclk
> before return from rockchip_saradc_resume in the error
> handling case when fails to prepare and enable info->clk.
> 
> Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc")
> Suggested-by:Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>

Looks good to me.  I'll just give it a little longer on the list so Heiko
and others have a chance to sanity check it.

Thanks,

Jonathan

> ---
> v2: remove useless braces because early return is pointless.
> 
>  drivers/iio/adc/rockchip_saradc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
> index 1f3d7d639..12584f163 100644
> --- a/drivers/iio/adc/rockchip_saradc.c
> +++ b/drivers/iio/adc/rockchip_saradc.c
> @@ -462,7 +462,7 @@ static int rockchip_saradc_resume(struct device *dev)
>  
>  	ret = clk_prepare_enable(info->clk);
>  	if (ret)
> -		return ret;
> +		clk_disable_unprepare(info->pclk);
>  
>  	return ret;
>  }
Jonathan Cameron Nov. 21, 2020, 4:39 p.m. UTC | #2
On Sun, 8 Nov 2020 15:41:28 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 3 Nov 2020 20:07:43 +0800
> Qinglang Miao <miaoqinglang@huawei.com> wrote:
> 
> > Fix the missing clk_disable_unprepare() of info->pclk
> > before return from rockchip_saradc_resume in the error
> > handling case when fails to prepare and enable info->clk.
> > 
> > Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc")
> > Suggested-by:Robin Murphy <robin.murphy@arm.com>
> > Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>  
> 
> Looks good to me.  I'll just give it a little longer on the list so Heiko
> and others have a chance to sanity check it.
> 
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> Thanks,
> 
> Jonathan
> 
> > ---
> > v2: remove useless braces because early return is pointless.
> > 
> >  drivers/iio/adc/rockchip_saradc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
> > index 1f3d7d639..12584f163 100644
> > --- a/drivers/iio/adc/rockchip_saradc.c
> > +++ b/drivers/iio/adc/rockchip_saradc.c
> > @@ -462,7 +462,7 @@ static int rockchip_saradc_resume(struct device *dev)
> >  
> >  	ret = clk_prepare_enable(info->clk);
> >  	if (ret)
> > -		return ret;
> > +		clk_disable_unprepare(info->pclk);
> >  
> >  	return ret;
> >  }  
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index 1f3d7d639..12584f163 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -462,7 +462,7 @@  static int rockchip_saradc_resume(struct device *dev)
 
 	ret = clk_prepare_enable(info->clk);
 	if (ret)
-		return ret;
+		clk_disable_unprepare(info->pclk);
 
 	return ret;
 }