Skip to contentSkip to conversation

Staging: iio: Simplify return logic

PATCH In review Cristina Opriceana 2 participants 2 messages Mar 12, 2015

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

PATCH 1/1 Staging: iio: Simplify return logic

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.

---
 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(-)
drivers/staging/iio/meter/ade7753.c +1 -5
index 78e8f56..30d8adf 100644
@@ -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 */
drivers/staging/iio/meter/ade7754.c +1 -5
index 81f6731..d21f935 100644
@@ -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 */
drivers/staging/iio/meter/ade7759.c +1 -5
index 694e0ce..418aa9e 100644
@@ -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 */
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Cristina Opriceana

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.

Quoted 66 lines
---
 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(-)
drivers/staging/iio/meter/ade7753.c +1 -5
index 78e8f56..30d8adf 100644
@@ -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 */
drivers/staging/iio/meter/ade7754.c +1 -5
index 81f6731..d21f935 100644
@@ -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 */
drivers/staging/iio/meter/ade7759.c +1 -6
index 694e0ce..418aa9e 100644
@@ -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 [email protected]. To post to this group, send email to [email protected].
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.