All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: frequency: admv1014: return -EINVAL directly
@ 2022-08-19 10:41 Antoniu Miclaus
  2022-08-19 17:08 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Antoniu Miclaus @ 2022-08-19 10:41 UTC (permalink / raw)
  To: linux-kernel, jic23, linux-iio; +Cc: Antoniu Miclaus

Remove extra step where the error code is assigned to the `ret`
variable.

Return instead error code directly.

Fixes: f4eb9ac ("iio: frequency: admv1014: add support for ADMV1014")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/frequency/admv1014.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/frequency/admv1014.c b/drivers/iio/frequency/admv1014.c
index 865addd10db4..bb5e1feef42b 100644
--- a/drivers/iio/frequency/admv1014.c
+++ b/drivers/iio/frequency/admv1014.c
@@ -669,8 +669,7 @@ static int admv1014_init(struct admv1014_state *st)
 	chip_id = FIELD_GET(ADMV1014_CHIP_ID_MSK, chip_id);
 	if (chip_id != ADMV1014_CHIP_ID) {
 		dev_err(&spi->dev, "Invalid Chip ID.\n");
-		ret = -EINVAL;
-		return ret;
+		return -EINVAL;
 	}
 
 	ret = __admv1014_spi_update_bits(st, ADMV1014_REG_QUAD,
-- 
2.37.2


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

* Re: [PATCH] iio: frequency: admv1014: return -EINVAL directly
  2022-08-19 10:41 [PATCH] iio: frequency: admv1014: return -EINVAL directly Antoniu Miclaus
@ 2022-08-19 17:08 ` Jonathan Cameron
  2022-08-20 15:56   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2022-08-19 17:08 UTC (permalink / raw)
  To: Antoniu Miclaus; +Cc: linux-kernel, linux-iio

On Fri, 19 Aug 2022 13:41:17 +0300
Antoniu Miclaus <antoniu.miclaus@analog.com> wrote:

> Remove extra step where the error code is assigned to the `ret`
> variable.
> 
> Return instead error code directly.
> 
> Fixes: f4eb9ac ("iio: frequency: admv1014: add support for ADMV1014")
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Change is fine, but I've dropped the fixes tag. The code before this
wasn't broken, just longer than it needed to be. We don't want the noise
of this getting backported because someone sees the fixes tag and thinks
there is a reason it needs to be.

Applied to the togreg branch of iio.git
Thanks,

Jonathan


 
> ---
>  drivers/iio/frequency/admv1014.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/frequency/admv1014.c b/drivers/iio/frequency/admv1014.c
> index 865addd10db4..bb5e1feef42b 100644
> --- a/drivers/iio/frequency/admv1014.c
> +++ b/drivers/iio/frequency/admv1014.c
> @@ -669,8 +669,7 @@ static int admv1014_init(struct admv1014_state *st)
>  	chip_id = FIELD_GET(ADMV1014_CHIP_ID_MSK, chip_id);
>  	if (chip_id != ADMV1014_CHIP_ID) {
>  		dev_err(&spi->dev, "Invalid Chip ID.\n");
> -		ret = -EINVAL;
> -		return ret;
> +		return -EINVAL;
>  	}
>  
>  	ret = __admv1014_spi_update_bits(st, ADMV1014_REG_QUAD,


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

* Re: [PATCH] iio: frequency: admv1014: return -EINVAL directly
  2022-08-19 17:08 ` Jonathan Cameron
@ 2022-08-20 15:56   ` Andy Shevchenko
  2022-08-21 16:29     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2022-08-20 15:56 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Antoniu Miclaus, Linux Kernel Mailing List, linux-iio

On Fri, Aug 19, 2022 at 8:41 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Fri, 19 Aug 2022 13:41:17 +0300
> Antoniu Miclaus <antoniu.miclaus@analog.com> wrote:
>
> > Remove extra step where the error code is assigned to the `ret`
> > variable.
> >
> > Return instead error code directly.

...

> Change is fine, but I've dropped the fixes tag. The code before this
> wasn't broken, just longer than it needed to be. We don't want the noise
> of this getting backported because someone sees the fixes tag and thinks
> there is a reason it needs to be.
>
> Applied to the togreg branch of iio.git

Haven't checked myself if it's possible, but shouldn;'t we go further
and return dev_err_probe()?

> >       chip_id = FIELD_GET(ADMV1014_CHIP_ID_MSK, chip_id);
> >       if (chip_id != ADMV1014_CHIP_ID) {
> >               dev_err(&spi->dev, "Invalid Chip ID.\n");
> > -             ret = -EINVAL;
> > -             return ret;
> > +             return -EINVAL;
> >       }


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] iio: frequency: admv1014: return -EINVAL directly
  2022-08-20 15:56   ` Andy Shevchenko
@ 2022-08-21 16:29     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2022-08-21 16:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Antoniu Miclaus, Linux Kernel Mailing List, linux-iio

On Sat, 20 Aug 2022 18:56:53 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Fri, Aug 19, 2022 at 8:41 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > On Fri, 19 Aug 2022 13:41:17 +0300
> > Antoniu Miclaus <antoniu.miclaus@analog.com> wrote:
> >  
> > > Remove extra step where the error code is assigned to the `ret`
> > > variable.
> > >
> > > Return instead error code directly.  
> 
> ...
> 
> > Change is fine, but I've dropped the fixes tag. The code before this
> > wasn't broken, just longer than it needed to be. We don't want the noise
> > of this getting backported because someone sees the fixes tag and thinks
> > there is a reason it needs to be.
> >
> > Applied to the togreg branch of iio.git  
> 
> Haven't checked myself if it's possible, but shouldn;'t we go further
> and return dev_err_probe()?

Good idea, but only as part of a patch doing that throughout the driver.
So follow up patch perhaps..

> 
> > >       chip_id = FIELD_GET(ADMV1014_CHIP_ID_MSK, chip_id);
> > >       if (chip_id != ADMV1014_CHIP_ID) {
> > >               dev_err(&spi->dev, "Invalid Chip ID.\n");
> > > -             ret = -EINVAL;
> > > -             return ret;
> > > +             return -EINVAL;
> > >       }  
> 
> 


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

end of thread, other threads:[~2022-08-21 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19 10:41 [PATCH] iio: frequency: admv1014: return -EINVAL directly Antoniu Miclaus
2022-08-19 17:08 ` Jonathan Cameron
2022-08-20 15:56   ` Andy Shevchenko
2022-08-21 16:29     ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.