linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: Aspeed ADC - Handle return value of clk_prepare_enable
@ 2017-05-29  7:42 Arvind Yadav
  2017-06-03  8:50 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Arvind Yadav @ 2017-05-29  7:42 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw; +Cc: linux-iio, linux-kernel

clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/iio/adc/aspeed_adc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
index 62670cb..e0ea411 100644
--- a/drivers/iio/adc/aspeed_adc.c
+++ b/drivers/iio/adc/aspeed_adc.c
@@ -212,7 +212,10 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 	}
 
 	/* Start all channels in normal mode. */
-	clk_prepare_enable(data->clk_scaler->clk);
+	ret = clk_prepare_enable(data->clk_scaler->clk);
+	if (ret)
+		goto clk_enable_error;
+
 	adc_engine_control_reg_val = GENMASK(31, 16) |
 		ASPEED_OPERATION_MODE_NORMAL | ASPEED_ENGINE_ENABLE;
 	writel(adc_engine_control_reg_val,
@@ -236,6 +239,7 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 	writel(ASPEED_OPERATION_MODE_POWER_DOWN,
 		data->base + ASPEED_REG_ENGINE_CONTROL);
 	clk_disable_unprepare(data->clk_scaler->clk);
+clk_enable_error:
 	clk_hw_unregister_divider(data->clk_scaler);
 
 scaler_error:
-- 
1.9.1

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

* Re: [PATCH] iio: Aspeed ADC - Handle return value of clk_prepare_enable
  2017-05-29  7:42 [PATCH] iio: Aspeed ADC - Handle return value of clk_prepare_enable Arvind Yadav
@ 2017-06-03  8:50 ` Jonathan Cameron
  2017-06-05 17:06   ` Rick Altherr
       [not found]   ` <CAPLgG=ntKrR=fvQKa=Z+CE0Ey3ELnGckfyWm4z_UpVN3h=dvcw@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Cameron @ 2017-06-03  8:50 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: knaack.h, lars, pmeerw, linux-iio, linux-kernel, Rick Altherr

On Mon, 29 May 2017 13:12:12 +0530
Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:

> clk_prepare_enable() can fail here and we must check its return value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Please make sure to cc the driver author.  This is a fairly new
driver, so chances are Rick will still be answering this email
address.

Patch looks fine to me, but I would like to give Rick the opportunity
to respond.

Jonathan
> ---
>  drivers/iio/adc/aspeed_adc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
> index 62670cb..e0ea411 100644
> --- a/drivers/iio/adc/aspeed_adc.c
> +++ b/drivers/iio/adc/aspeed_adc.c
> @@ -212,7 +212,10 @@ static int aspeed_adc_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Start all channels in normal mode. */
> -	clk_prepare_enable(data->clk_scaler->clk);
> +	ret = clk_prepare_enable(data->clk_scaler->clk);
> +	if (ret)
> +		goto clk_enable_error;
> +
>  	adc_engine_control_reg_val = GENMASK(31, 16) |
>  		ASPEED_OPERATION_MODE_NORMAL | ASPEED_ENGINE_ENABLE;
>  	writel(adc_engine_control_reg_val,
> @@ -236,6 +239,7 @@ static int aspeed_adc_probe(struct platform_device *pdev)
>  	writel(ASPEED_OPERATION_MODE_POWER_DOWN,
>  		data->base + ASPEED_REG_ENGINE_CONTROL);
>  	clk_disable_unprepare(data->clk_scaler->clk);
> +clk_enable_error:
>  	clk_hw_unregister_divider(data->clk_scaler);
>  
>  scaler_error:

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

* Re: [PATCH] iio: Aspeed ADC - Handle return value of clk_prepare_enable
  2017-06-03  8:50 ` Jonathan Cameron
@ 2017-06-05 17:06   ` Rick Altherr
       [not found]   ` <CAPLgG=ntKrR=fvQKa=Z+CE0Ey3ELnGckfyWm4z_UpVN3h=dvcw@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Rick Altherr @ 2017-06-05 17:06 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Arvind Yadav, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Linux Kernel Mailing List

Reviewed-by: Rick Altherr <raltherr@google.com>

On Sat, Jun 3, 2017 at 1:50 AM, Jonathan Cameron <jic23@kernel.org> wrote:
> On Mon, 29 May 2017 13:12:12 +0530
> Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
>
>> clk_prepare_enable() can fail here and we must check its return value.
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> Please make sure to cc the driver author.  This is a fairly new
> driver, so chances are Rick will still be answering this email
> address.
>
> Patch looks fine to me, but I would like to give Rick the opportunity
> to respond.
>
> Jonathan
>> ---
>>  drivers/iio/adc/aspeed_adc.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
>> index 62670cb..e0ea411 100644
>> --- a/drivers/iio/adc/aspeed_adc.c
>> +++ b/drivers/iio/adc/aspeed_adc.c
>> @@ -212,7 +212,10 @@ static int aspeed_adc_probe(struct platform_device *pdev)
>>       }
>>
>>       /* Start all channels in normal mode. */
>> -     clk_prepare_enable(data->clk_scaler->clk);
>> +     ret = clk_prepare_enable(data->clk_scaler->clk);
>> +     if (ret)
>> +             goto clk_enable_error;
>> +
>>       adc_engine_control_reg_val = GENMASK(31, 16) |
>>               ASPEED_OPERATION_MODE_NORMAL | ASPEED_ENGINE_ENABLE;
>>       writel(adc_engine_control_reg_val,
>> @@ -236,6 +239,7 @@ static int aspeed_adc_probe(struct platform_device *pdev)
>>       writel(ASPEED_OPERATION_MODE_POWER_DOWN,
>>               data->base + ASPEED_REG_ENGINE_CONTROL);
>>       clk_disable_unprepare(data->clk_scaler->clk);
>> +clk_enable_error:
>>       clk_hw_unregister_divider(data->clk_scaler);
>>
>>  scaler_error:
>

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

* Re: [PATCH] iio: Aspeed ADC - Handle return value of clk_prepare_enable
       [not found]   ` <CAPLgG=ntKrR=fvQKa=Z+CE0Ey3ELnGckfyWm4z_UpVN3h=dvcw@mail.gmail.com>
@ 2017-06-11 14:08     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2017-06-11 14:08 UTC (permalink / raw)
  To: Rick Altherr
  Cc: Arvind Yadav, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Linux Kernel Mailing List

On Mon, 5 Jun 2017 09:56:25 -0700
Rick Altherr <raltherr@google.com> wrote:

> Reviewed-by: Rick Altherr <raltherr@google.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> 
> On Sat, Jun 3, 2017 at 1:50 AM, Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > On Mon, 29 May 2017 13:12:12 +0530
> > Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
> >  
> > > clk_prepare_enable() can fail here and we must check its return value.
> > >
> > > Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>  
> > Please make sure to cc the driver author.  This is a fairly new
> > driver, so chances are Rick will still be answering this email
> > address.
> >
> > Patch looks fine to me, but I would like to give Rick the opportunity
> > to respond.
> >
> > Jonathan  
> > > ---
> > >  drivers/iio/adc/aspeed_adc.c | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
> > > index 62670cb..e0ea411 100644
> > > --- a/drivers/iio/adc/aspeed_adc.c
> > > +++ b/drivers/iio/adc/aspeed_adc.c
> > > @@ -212,7 +212,10 @@ static int aspeed_adc_probe(struct platform_device  
> > *pdev)  
> > >       }
> > >
> > >       /* Start all channels in normal mode. */
> > > -     clk_prepare_enable(data->clk_scaler->clk);
> > > +     ret = clk_prepare_enable(data->clk_scaler->clk);
> > > +     if (ret)
> > > +             goto clk_enable_error;
> > > +
> > >       adc_engine_control_reg_val = GENMASK(31, 16) |
> > >               ASPEED_OPERATION_MODE_NORMAL | ASPEED_ENGINE_ENABLE;
> > >       writel(adc_engine_control_reg_val,
> > > @@ -236,6 +239,7 @@ static int aspeed_adc_probe(struct platform_device  
> > *pdev)  
> > >       writel(ASPEED_OPERATION_MODE_POWER_DOWN,
> > >               data->base + ASPEED_REG_ENGINE_CONTROL);
> > >       clk_disable_unprepare(data->clk_scaler->clk);
> > > +clk_enable_error:
> > >       clk_hw_unregister_divider(data->clk_scaler);
> > >
> > >  scaler_error:  
> >
> >  

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

end of thread, other threads:[~2017-06-11 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-29  7:42 [PATCH] iio: Aspeed ADC - Handle return value of clk_prepare_enable Arvind Yadav
2017-06-03  8:50 ` Jonathan Cameron
2017-06-05 17:06   ` Rick Altherr
     [not found]   ` <CAPLgG=ntKrR=fvQKa=Z+CE0Ey3ELnGckfyWm4z_UpVN3h=dvcw@mail.gmail.com>
2017-06-11 14:08     ` 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).