Skip to contentSkip to conversation

staging: iio: compress return logic

PATCH In review Gargi Sharma 3 participants 3 messages Feb 17, 2017 – Feb 18, 2017

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

PATCH 1/1 staging: iio: compress return logic

Simplify function returns by merging assignment and return. Found with Coccinelle.

Semantic patch:
@@
local idexpression ret;
expression e;
@@

-ret =
+return

     e;

-return ret;

---
 drivers/staging/iio/meter/ade7854.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/iio/meter/ade7854.c +1 -3
index e8007f0..c6cffc1 100644
@@ -426,9 +426,7 @@ static int ade7854_set_irq(struct device *dev, bool enable)
 	else
 		irqen &= ~BIT(17);
 
-	ret = st->write_reg_32(dev, ADE7854_MASK0, irqen);
-
-	return ret;
+	return st->write_reg_32(dev, ADE7854_MASK0, irqen);
 }
 
 static int ade7854_initial_setup(struct iio_dev *indio_dev)
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Gargi Sharma

Simplify function returns by merging assignment and return. Found with Coccinelle.

Semantic patch:
@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;
Quoted 1 line
Quoted 29 lines
---
 drivers/staging/iio/meter/ade7854.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/iio/meter/ade7854.c +1 -4
index e8007f0..c6cffc1 100644
@@ -426,9 +426,7 @@ static int ade7854_set_irq(struct device *dev, bool enable)
 	else
 		irqen &= ~BIT(17);
 
-	ret = st->write_reg_32(dev, ADE7854_MASK0, irqen);
-
-	return ret;
+	return st->write_reg_32(dev, ADE7854_MASK0, irqen);
 }
 
 static int ade7854_initial_setup(struct iio_dev *indio_dev)
--

2.7.4

--
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/1487351841-6639-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#2 lore raw
Quoted 13 lines · Julia Lawall
Quoted 9 lines · Gargi Sharma

Simplify function returns by merging assignment and return. Found with Coccinelle.

Semantic patch:
@@
local idexpression ret;
expression e;
@@

Quoted 8 lines
Quoted 6 lines
(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 30 lines
Quoted 30 lines
---
 drivers/staging/iio/meter/ade7854.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/iio/meter/ade7854.c +1 -4
index e8007f0..c6cffc1 100644
@@ -426,9 +426,7 @@ static int ade7854_set_irq(struct device *dev, bool enable)
 	else
 		irqen &= ~BIT(17);
 
-	ret = st->write_reg_32(dev, ADE7854_MASK0, irqen);
-
-	return ret;
+	return st->write_reg_32(dev, ADE7854_MASK0, irqen);
 }
 
 static int ade7854_initial_setup(struct iio_dev *indio_dev)
--

2.7.4

--
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/1487351841-6639-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.