linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
@ 2021-08-19 13:24 Yang Yingliang
  2021-08-19 17:20 ` Andy Shevchenko
  2021-08-20 14:04 ` Prabhakar Mahadev Lad
  0 siblings, 2 replies; 8+ messages in thread
From: Yang Yingliang @ 2021-08-19 13:24 UTC (permalink / raw)
  To: linux-kernel, linux-iio; +Cc: prabhakar.mahadev-lad.rj, jic23

Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/iio/adc/rzg2l_adc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c
index 9996d5eef289..c38f43ea624f 100644
--- a/drivers/iio/adc/rzg2l_adc.c
+++ b/drivers/iio/adc/rzg2l_adc.c
@@ -570,8 +570,10 @@ static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev)
 		return ret;
 
 	ret = clk_prepare_enable(adc->adclk);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(adc->pclk);
 		return ret;
+	}
 
 	rzg2l_adc_pwr(adc, true);
 
-- 
2.25.1


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

* Re: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  2021-08-19 13:24 [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume() Yang Yingliang
@ 2021-08-19 17:20 ` Andy Shevchenko
  2021-08-20  1:52   ` Yang Yingliang
  2021-08-20  6:46   ` Sa, Nuno
  2021-08-20 14:04 ` Prabhakar Mahadev Lad
  1 sibling, 2 replies; 8+ messages in thread
From: Andy Shevchenko @ 2021-08-19 17:20 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, linux-iio, prabhakar.mahadev-lad.rj, jic23

On Thu, Aug 19, 2021 at 4:19 PM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().

...

>         ret = clk_prepare_enable(adc->adclk);
> -       if (ret)
> +       if (ret) {
> +               clk_disable_unprepare(adc->pclk);
>                 return ret;
> +       }

Huh?!

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  2021-08-19 17:20 ` Andy Shevchenko
@ 2021-08-20  1:52   ` Yang Yingliang
  2021-08-20  9:17     ` Andy Shevchenko
  2021-08-20  6:46   ` Sa, Nuno
  1 sibling, 1 reply; 8+ messages in thread
From: Yang Yingliang @ 2021-08-20  1:52 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, linux-iio, prabhakar.mahadev-lad.rj, jic23

Hi,

On 2021/8/20 1:20, Andy Shevchenko wrote:
> On Thu, Aug 19, 2021 at 4:19 PM Yang Yingliang <yangyingliang@huawei.com> wrote:
>> Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().
> ...
>
>>          ret = clk_prepare_enable(adc->adclk);
>> -       if (ret)
>> +       if (ret) {
>> +               clk_disable_unprepare(adc->pclk);
>>                  return ret;
>> +       }
> Huh?!
The pclk need be disabled, when enable adclk failed.
       ^                                                         ^^
>

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

* RE: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  2021-08-19 17:20 ` Andy Shevchenko
  2021-08-20  1:52   ` Yang Yingliang
@ 2021-08-20  6:46   ` Sa, Nuno
  1 sibling, 0 replies; 8+ messages in thread
From: Sa, Nuno @ 2021-08-20  6:46 UTC (permalink / raw)
  To: Andy Shevchenko, Yang Yingliang
  Cc: linux-kernel, linux-iio, prabhakar.mahadev-lad.rj, jic23

> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Thursday, August 19, 2021 7:21 PM
> To: Yang Yingliang <yangyingliang@huawei.com>
> Cc: linux-kernel@vger.kernel.org; linux-iio@vger.kernel.org;
> prabhakar.mahadev-lad.rj@bp.renesas.com; jic23@kernel.org
> Subject: Re: [PATCH -next] iio: adc: add missing
> clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
> 
> On Thu, Aug 19, 2021 at 4:19 PM Yang Yingliang
> <yangyingliang@huawei.com> wrote:
> >
> > Add clk_disable_unprepare() on error path in
> rzg2l_adc_pm_runtime_resume().
> 
> ...
> 
> >         ret = clk_prepare_enable(adc->adclk);
> > -       if (ret)
> > +       if (ret) {
> > +               clk_disable_unprepare(adc->pclk);
> >                 return ret;
> > +       }
> 
> Huh?!
> 

Had the same reaction when looked at this patch. Look at the
clock names :).

- Nuno Sá

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

* Re: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  2021-08-20  1:52   ` Yang Yingliang
@ 2021-08-20  9:17     ` Andy Shevchenko
  2021-08-30 10:58       ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2021-08-20  9:17 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: Linux Kernel Mailing List, linux-iio, Lad Prabhakar, Jonathan Cameron

On Fri, Aug 20, 2021 at 4:52 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
> On 2021/8/20 1:20, Andy Shevchenko wrote:
> > On Thu, Aug 19, 2021 at 4:19 PM Yang Yingliang <yangyingliang@huawei.com> wrote:
> >> Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().
> > ...
> >
> >>          ret = clk_prepare_enable(adc->adclk);
> >> -       if (ret)
> >> +       if (ret) {
> >> +               clk_disable_unprepare(adc->pclk);
> >>                  return ret;
> >> +       }
> > Huh?!
> The pclk need be disabled, when enable adclk failed.
>        ^                                                         ^^

Indeed. I'm wondering if those clocks behave like a bulk or any
combination is possible on a working case?

-- 
With Best Regards,
Andy Shevchenko

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

* RE: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  2021-08-19 13:24 [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume() Yang Yingliang
  2021-08-19 17:20 ` Andy Shevchenko
@ 2021-08-20 14:04 ` Prabhakar Mahadev Lad
  2021-08-30 11:00   ` Jonathan Cameron
  1 sibling, 1 reply; 8+ messages in thread
From: Prabhakar Mahadev Lad @ 2021-08-20 14:04 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, linux-iio; +Cc: jic23

Hi Yang,

Thank you for the patch.

> -----Original Message-----
> From: Yang Yingliang <yangyingliang@huawei.com>
> Sent: 19 August 2021 14:24
> To: linux-kernel@vger.kernel.org; linux-iio@vger.kernel.org
> Cc: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>; jic23@kernel.org
> Subject: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
> 
> Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/iio/adc/rzg2l_adc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
With subject line changed to, iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()

Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Cheers,
Prabhakar

> diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c index
> 9996d5eef289..c38f43ea624f 100644
> --- a/drivers/iio/adc/rzg2l_adc.c
> +++ b/drivers/iio/adc/rzg2l_adc.c
> @@ -570,8 +570,10 @@ static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev)
>  		return ret;
> 
>  	ret = clk_prepare_enable(adc->adclk);
> -	if (ret)
> +	if (ret) {
> +		clk_disable_unprepare(adc->pclk);
>  		return ret;
> +	}
> 
>  	rzg2l_adc_pwr(adc, true);
> 
> --
> 2.25.1


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

* Re: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  2021-08-20  9:17     ` Andy Shevchenko
@ 2021-08-30 10:58       ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2021-08-30 10:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Yang Yingliang, Linux Kernel Mailing List, linux-iio, Lad Prabhakar

On Fri, 20 Aug 2021 12:17:46 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Fri, Aug 20, 2021 at 4:52 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
> > On 2021/8/20 1:20, Andy Shevchenko wrote:  
> > > On Thu, Aug 19, 2021 at 4:19 PM Yang Yingliang <yangyingliang@huawei.com> wrote:  
> > >> Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().  
> > > ...
> > >  
> > >>          ret = clk_prepare_enable(adc->adclk);
> > >> -       if (ret)
> > >> +       if (ret) {
> > >> +               clk_disable_unprepare(adc->pclk);
> > >>                  return ret;
> > >> +       }  
> > > Huh?!  
> > The pclk need be disabled, when enable adclk failed.
> >        ^                                                         ^^  
> 
> Indeed. I'm wondering if those clocks behave like a bulk or any
> combination is possible on a working case?

They are handled independently in other parts of the driver, so bulk
setting is going to be a mess.

> 


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

* Re: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  2021-08-20 14:04 ` Prabhakar Mahadev Lad
@ 2021-08-30 11:00   ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2021-08-30 11:00 UTC (permalink / raw)
  To: Prabhakar Mahadev Lad; +Cc: Yang Yingliang, linux-kernel, linux-iio

On Fri, 20 Aug 2021 14:04:15 +0000
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:

> Hi Yang,
> 
> Thank you for the patch.
> 
> > -----Original Message-----
> > From: Yang Yingliang <yangyingliang@huawei.com>
> > Sent: 19 August 2021 14:24
> > To: linux-kernel@vger.kernel.org; linux-iio@vger.kernel.org
> > Cc: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>; jic23@kernel.org
> > Subject: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
> > 
> > Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().
> > 
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > ---
> >  drivers/iio/adc/rzg2l_adc.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >   
> With subject line changed to, iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
> 
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Patch title updated as suggested and applied to the fixes-togreg branch of iio.git
which will go upstream sometime after rc1.

Thanks,

Jonathan

> 
> Cheers,
> Prabhakar
> 
> > diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c index
> > 9996d5eef289..c38f43ea624f 100644
> > --- a/drivers/iio/adc/rzg2l_adc.c
> > +++ b/drivers/iio/adc/rzg2l_adc.c
> > @@ -570,8 +570,10 @@ static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev)
> >  		return ret;
> > 
> >  	ret = clk_prepare_enable(adc->adclk);
> > -	if (ret)
> > +	if (ret) {
> > +		clk_disable_unprepare(adc->pclk);
> >  		return ret;
> > +	}
> > 
> >  	rzg2l_adc_pwr(adc, true);
> > 
> > --
> > 2.25.1  
> 


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

end of thread, other threads:[~2021-08-30 10:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 13:24 [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume() Yang Yingliang
2021-08-19 17:20 ` Andy Shevchenko
2021-08-20  1:52   ` Yang Yingliang
2021-08-20  9:17     ` Andy Shevchenko
2021-08-30 10:58       ` Jonathan Cameron
2021-08-20  6:46   ` Sa, Nuno
2021-08-20 14:04 ` Prabhakar Mahadev Lad
2021-08-30 11:00   ` Jonathan Cameron

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