Skip to contentSkip to conversation

Staging: pi433: Merge assignment with return value

PATCH In review Meghana Madhyastha 2 participants 2 messages Sep 15, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: pi433: Merge assignment with return value

Removes the unnecessary assignment of retval preceding the return statement.

Detected using the following Coccinelle script:
@@
local idexpression ret;
expression e;
@@

-ret =
+return

     e;

-return ret;

---
 drivers/staging/pi433/rf69.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/pi433/rf69.c +1 -3
index c4b1b21..f5b90aa 100644
@@ -690,9 +690,7 @@ int rf69_set_preamble_length(struct spi_device *spi, u16 preambleLength)
 	/* transmit to chip */
 	retval = WRITE_REG(REG_PREAMBLE_MSB, msb);
 	if (retval) return retval;
-	retval = WRITE_REG(REG_PREAMBLE_LSB, lsb);
-
-	return retval;
+	return WRITE_REG(REG_PREAMBLE_LSB, lsb);
 }
 
 int rf69_set_sync_enable(struct spi_device *spi, enum optionOnOff optionOnOff)
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Meghana Madhyastha

Removes the unnecessary assignment of retval preceding the return statement.

Detected using the following Coccinelle script:
@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;
Quoted 1 line
Quoted 29 lines
---
 drivers/staging/pi433/rf69.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/pi433/rf69.c +1 -4
index c4b1b21..f5b90aa 100644
@@ -690,9 +690,7 @@ int rf69_set_preamble_length(struct spi_device *spi, u16 preambleLength)
 	/* transmit to chip */
 	retval = WRITE_REG(REG_PREAMBLE_MSB, msb);
 	if (retval) return retval;
-	retval = WRITE_REG(REG_PREAMBLE_LSB, lsb);
-
-	return retval;
+	return WRITE_REG(REG_PREAMBLE_LSB, lsb);
 }
 
 int rf69_set_sync_enable(struct spi_device *spi, enum optionOnOff optionOnOff)
--

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/20170915070424.GA18122%40meghana-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.