linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
@ 2020-11-03 12:07 Qinglang Miao
  2020-11-08 15:41 ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Qinglang Miao @ 2020-11-03 12:07 UTC (permalink / raw)
  To: Robin Murphy, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Heiko Stuebner
  Cc: linux-iio, linux-arm-kernel, linux-rockchip, linux-kernel, Qinglang Miao

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(-)

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;
 }
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
  2020-11-03 12:07 [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume Qinglang Miao
@ 2020-11-08 15:41 ` Jonathan Cameron
  2020-11-21 16:39   ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2020-11-08 15:41 UTC (permalink / raw)
  To: Qinglang Miao
  Cc: Robin Murphy, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Heiko Stuebner, linux-iio, linux-arm-kernel, linux-rockchip,
	linux-kernel

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;
>  }


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
  2020-11-08 15:41 ` Jonathan Cameron
@ 2020-11-21 16:39   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-11-21 16:39 UTC (permalink / raw)
  To: Qinglang Miao
  Cc: Robin Murphy, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Heiko Stuebner, linux-iio, linux-arm-kernel, linux-rockchip,
	linux-kernel

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;
> >  }  
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
  2020-11-03 11:11 ` Robin Murphy
@ 2020-11-03 12:04   ` Qinglang Miao
  0 siblings, 0 replies; 7+ messages in thread
From: Qinglang Miao @ 2020-11-03 12:04 UTC (permalink / raw)
  To: Robin Murphy, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Heiko Stuebner
  Cc: linux-iio, linux-rockchip, linux-kernel, linux-arm-kernel



在 2020/11/3 19:11, Robin Murphy 写道:
> On 2020-11-03 07:49, Qinglang Miao 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")
>> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
>> ---
>>   drivers/iio/adc/rockchip_saradc.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/adc/rockchip_saradc.c 
>> b/drivers/iio/adc/rockchip_saradc.c
>> index 1f3d7d639..5eb566274 100644
>> --- a/drivers/iio/adc/rockchip_saradc.c
>> +++ b/drivers/iio/adc/rockchip_saradc.c
>> @@ -461,9 +461,10 @@ static int rockchip_saradc_resume(struct device 
>> *dev)
>>           return ret;
>>       ret = clk_prepare_enable(info->clk);
>> -    if (ret)
>> +    if (ret) {
>> +        clk_disable_unprepare(info->pclk);
>>           return ret;
> 
> No need to add braces, just replace this utterly pointless "early" 
> return ;)
> 
> Robin.
You are right Robin, thanks a lot! :D

I've sent a 'real' v2 patch based on your advice.
> 
>> -
>> +    }
>>       return ret;
>>   }
>>   #endif
>>
> .

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
  2020-11-03  7:49 Qinglang Miao
  2020-11-03  8:20 ` Qinglang Miao
@ 2020-11-03 11:11 ` Robin Murphy
  2020-11-03 12:04   ` Qinglang Miao
  1 sibling, 1 reply; 7+ messages in thread
From: Robin Murphy @ 2020-11-03 11:11 UTC (permalink / raw)
  To: Qinglang Miao, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Heiko Stuebner
  Cc: linux-iio, linux-rockchip, linux-kernel, linux-arm-kernel

On 2020-11-03 07:49, Qinglang Miao 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")
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>   drivers/iio/adc/rockchip_saradc.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
> index 1f3d7d639..5eb566274 100644
> --- a/drivers/iio/adc/rockchip_saradc.c
> +++ b/drivers/iio/adc/rockchip_saradc.c
> @@ -461,9 +461,10 @@ static int rockchip_saradc_resume(struct device *dev)
>   		return ret;
>   
>   	ret = clk_prepare_enable(info->clk);
> -	if (ret)
> +	if (ret) {
> +		clk_disable_unprepare(info->pclk);
>   		return ret;

No need to add braces, just replace this utterly pointless "early" return ;)

Robin.

> -
> +	}
>   	return ret;
>   }
>   #endif
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
  2020-11-03  7:49 Qinglang Miao
@ 2020-11-03  8:20 ` Qinglang Miao
  2020-11-03 11:11 ` Robin Murphy
  1 sibling, 0 replies; 7+ messages in thread
From: Qinglang Miao @ 2020-11-03  8:20 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Heiko Stuebner
  Cc: linux-iio, linux-arm-kernel, linux-rockchip, linux-kernel



在 2020/11/3 15:49, Qinglang Miao 写道:
> 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")
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>   drivers/iio/adc/rockchip_saradc.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
> index 1f3d7d639..5eb566274 100644
> --- a/drivers/iio/adc/rockchip_saradc.c
> +++ b/drivers/iio/adc/rockchip_saradc.c
> @@ -461,9 +461,10 @@ static int rockchip_saradc_resume(struct device *dev)
>   		return ret;
>   
>   	ret = clk_prepare_enable(info->clk);
> -	if (ret)
> +	if (ret) {
> +		clk_disable_unprepare(info->pclk);
>   		return ret;
> -
> +	}
>   	return ret;
>   }
>   #endif
> 
Hi everyone,

I made a careless mistake for adding v2 as subject-prefix, this patch is 
the base version actually.

Sorry about that.

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
@ 2020-11-03  7:49 Qinglang Miao
  2020-11-03  8:20 ` Qinglang Miao
  2020-11-03 11:11 ` Robin Murphy
  0 siblings, 2 replies; 7+ messages in thread
From: Qinglang Miao @ 2020-11-03  7:49 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Heiko Stuebner
  Cc: linux-iio, linux-arm-kernel, linux-rockchip, linux-kernel, Qinglang Miao

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")
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 drivers/iio/adc/rockchip_saradc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index 1f3d7d639..5eb566274 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -461,9 +461,10 @@ static int rockchip_saradc_resume(struct device *dev)
 		return ret;
 
 	ret = clk_prepare_enable(info->clk);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(info->pclk);
 		return ret;
-
+	}
 	return ret;
 }
 #endif
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-11-21 16:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 12:07 [PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume Qinglang Miao
2020-11-08 15:41 ` Jonathan Cameron
2020-11-21 16:39   ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2020-11-03  7:49 Qinglang Miao
2020-11-03  8:20 ` Qinglang Miao
2020-11-03 11:11 ` Robin Murphy
2020-11-03 12:04   ` Qinglang Miao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).