All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: iio: Simplify return logic
@ 2015-03-12 17:10 Cristina Opriceana
  2015-03-12 18:31 ` [Outreachy kernel] " Daniel Baluta
  0 siblings, 1 reply; 2+ messages in thread
From: Cristina Opriceana @ 2015-03-12 17:10 UTC (permalink / raw)
  To: outreachy-kernel

This patch removes the conditional return of the ade77*_probe functions
based on the return values of iio_device_register as the latter
returns 0 or ret, the same as the checked values.

Warning found by coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/meter/ade7753.c | 6 +-----
 drivers/staging/iio/meter/ade7754.c | 6 +-----
 drivers/staging/iio/meter/ade7759.c | 6 +-----
 3 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
index 78e8f56..30d8adf 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -517,11 +517,7 @@ static int ade7753_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	ret = iio_device_register(indio_dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 /* fixme, confirm ordering in this function */
diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
index 81f6731..d21f935 100644
--- a/drivers/staging/iio/meter/ade7754.c
+++ b/drivers/staging/iio/meter/ade7754.c
@@ -540,11 +540,7 @@ static int ade7754_probe(struct spi_device *spi)
 	ret = ade7754_initial_setup(indio_dev);
 	if (ret)
 		return ret;
-	ret = iio_device_register(indio_dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 /* fixme, confirm ordering in this function */
diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
index 694e0ce..418aa9e 100644
--- a/drivers/staging/iio/meter/ade7759.c
+++ b/drivers/staging/iio/meter/ade7759.c
@@ -462,11 +462,7 @@ static int ade7759_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	ret = iio_device_register(indio_dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 /* fixme, confirm ordering in this function */
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH] Staging: iio: Simplify return logic
  2015-03-12 17:10 [PATCH] Staging: iio: Simplify return logic Cristina Opriceana
@ 2015-03-12 18:31 ` Daniel Baluta
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Baluta @ 2015-03-12 18:31 UTC (permalink / raw)
  To: Cristina Opriceana; +Cc: outreachy-kernel

On Thu, Mar 12, 2015 at 7:10 PM, Cristina Opriceana
<cristina.opriceana@gmail.com> wrote:
> This patch removes the conditional return of the ade77*_probe functions
> based on the return values of iio_device_register as the latter
> returns 0 or ret, the same as the checked values.
>
> Warning found by coccinelle.
>
> Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>

Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>

> ---
>  drivers/staging/iio/meter/ade7753.c | 6 +-----
>  drivers/staging/iio/meter/ade7754.c | 6 +-----
>  drivers/staging/iio/meter/ade7759.c | 6 +-----
>  3 files changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
> index 78e8f56..30d8adf 100644
> --- a/drivers/staging/iio/meter/ade7753.c
> +++ b/drivers/staging/iio/meter/ade7753.c
> @@ -517,11 +517,7 @@ static int ade7753_probe(struct spi_device *spi)
>         if (ret)
>                 return ret;
>
> -       ret = iio_device_register(indio_dev);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return iio_device_register(indio_dev);
>  }
>
>  /* fixme, confirm ordering in this function */
> diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
> index 81f6731..d21f935 100644
> --- a/drivers/staging/iio/meter/ade7754.c
> +++ b/drivers/staging/iio/meter/ade7754.c
> @@ -540,11 +540,7 @@ static int ade7754_probe(struct spi_device *spi)
>         ret = ade7754_initial_setup(indio_dev);
>         if (ret)
>                 return ret;
> -       ret = iio_device_register(indio_dev);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return iio_device_register(indio_dev);
>  }
>
>  /* fixme, confirm ordering in this function */
> diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
> index 694e0ce..418aa9e 100644
> --- a/drivers/staging/iio/meter/ade7759.c
> +++ b/drivers/staging/iio/meter/ade7759.c
> @@ -462,11 +462,7 @@ static int ade7759_probe(struct spi_device *spi)
>         if (ret)
>                 return ret;
>
> -       ret = iio_device_register(indio_dev);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return iio_device_register(indio_dev);
>  }
>
>  /* fixme, confirm ordering in this function */
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150312171031.GA3558%40Inspiron.
> For more options, visit https://groups.google.com/d/optout.


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

end of thread, other threads:[~2015-03-12 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 17:10 [PATCH] Staging: iio: Simplify return logic Cristina Opriceana
2015-03-12 18:31 ` [Outreachy kernel] " Daniel Baluta

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.