Skip to contentSkip to conversation

iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()

PATCH In review Yang Yingliang 5 participants 8 messages Aug 19, 2021 – Aug 30, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

---
 drivers/iio/adc/rzg2l_adc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/adc/rzg2l_adc.c +3 -1
index 9996d5eef289..c38f43ea624f 100644
@@ -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);
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · Yang Yingliang

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

...

drivers/iio/adc/rzg2l_adc.c static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev) · line 576

Quoted 6 lines
        ret = clk_prepare_enable(adc->adclk);
drivers/iio/adc/rzg2l_adc.c +3 -1
-       if (ret)
+       if (ret) {
+               clk_disable_unprepare(adc->pclk);
                return ret;
+       }

Huh?!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hi,

Quoted 11 lines · Andy Shevchenko
Quoted 1 line · Yang Yingliang

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

...

drivers/iio/adc/rzg2l_adc.c static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev) · line 576

Quoted 6 lines
         ret = clk_prepare_enable(adc->adclk);
drivers/iio/adc/rzg2l_adc.c +3 -1
-       if (ret)
+       if (ret) {
+               clk_disable_unprepare(adc->pclk);
                 return ret;
+       }

Huh?!

The pclk need be disabled, when enable adclk failed.
      ^                                                         ^^

Quoted 1 line
#3 lore raw
Quoted 11 lines · Yang Yingliang
Quoted 10 lines · Andy Shevchenko
Quoted 1 line · Yang Yingliang

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

...

Quoted 6 lines
         ret = clk_prepare_enable(adc->adclk);
drivers/iio/adc/rzg2l_adc.c +3 -1
-       if (ret)
+       if (ret) {
+               clk_disable_unprepare(adc->pclk);
                 return ret;
+       }
Quoted 3 lines
Quoted 1 line

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?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw
Quoted 12 lines · On Fri, 20 Aug 2021 12:17:46 +0300 Andy Shevchenko <[email protected]>…
Quoted 11 lines · Yang Yingliang
Quoted 10 lines · Andy Shevchenko
Quoted 1 line · Yang Yingliang

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

...

Quoted 6 lines
         ret = clk_prepare_enable(adc->adclk);
drivers/iio/adc/rzg2l_adc.c +3 -1
-       if (ret)
+       if (ret) {
+               clk_disable_unprepare(adc->pclk);
                 return ret;
+       }  
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 1 line
reviewer
#5 lore raw
In reply to Andy Shevchenko
Quoted 16 lines

From: Andy Shevchenko <[email protected]>
Sent: Thursday, August 19, 2021 7:21 PM
To: Yang Yingliang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()

Quoted 2 lines · Yang Yingliang

Add clk_disable_unprepare() on error path in

rzg2l_adc_pm_runtime_resume().

...

Quoted 9 lines

drivers/iio/adc/rzg2l_adc.c static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev) · line 576

Quoted 6 lines
        ret = clk_prepare_enable(adc->adclk);
drivers/iio/adc/rzg2l_adc.c +3 -1
-       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á

maintainer Reviewed-by on v1 1/1
#6 lore raw
In reply to Yang Yingliang

Hi Yang,

Thank you for the patch.

Quoted 7 lines

-----Original Message-----
From: Yang Yingliang <[email protected]>
Sent: 19 August 2021 14:24
To: [email protected]; [email protected]
Cc: Prabhakar Mahadev Lad <[email protected]>; [email protected]
Subject: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()

Quoted 8 lines

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

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

Cheers,
Prabhakar

Quoted 18 lines
drivers/iio/adc/rzg2l_adc.c index renamed from drivers/iio/adc/rzg2l_adc.c +0 -0

9996d5eef289..c38f43ea624f 100644

drivers/iio/adc/rzg2l_adc.c +3 -2
@@ -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

maintainer
#7 lore raw
Quoted 19 lines · On Fri, 20 Aug 2021 14:04:15 +0000 Prabhakar Mahadev Lad…

Hi Yang,

Thank you for the patch.

Quoted 7 lines

-----Original Message-----
From: Yang Yingliang <[email protected]>
Sent: 19 August 2021 14:24
To: [email protected]; [email protected]
Cc: Prabhakar Mahadev Lad <[email protected]>; [email protected]
Subject: [PATCH -next] iio: adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()

Quoted 8 lines

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

---
 drivers/iio/adc/rzg2l_adc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 3 lines

With subject line changed to, iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()

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

Thanks,

Jonathan

Quoted 23 lines

Cheers,
Prabhakar

Quoted 18 lines
drivers/iio/adc/rzg2l_adc.c index renamed from drivers/iio/adc/rzg2l_adc.c +0 -0

9996d5eef289..c38f43ea624f 100644

drivers/iio/adc/rzg2l_adc.c +3 -2
@@ -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