Skip to contentSkip to conversation

staging: wilc1000: wilc_spi.c: Modify return statement.

PATCH Superseded Sanjana Sanikommu 2 participants 2 messages Mar 28, 2019 Staging

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wilc1000: wilc_spi.c: Modify return statement.

The last two lines in the function could
be compressed into one. Avoid usage of local variable. Issue found with Coccinelle using ret.cocci.

---
 drivers/staging/wilc1000/wilc_spi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/wilc_spi.c +2 -4
index 4a1be9e60d74..9959a794edc7 100644
@@ -934,9 +934,8 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
 	int k = IRG_FLAGS_OFFSET + 5;
 
 	if (spi_priv->has_thrpt_enh) {
-		ret = spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE,
+		return spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE,
 					int_status);
-		return ret;
 	}
 	ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, &byte_cnt);
 	if (!ret) {
@@ -982,9 +981,8 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
 	u32 tbl_ctl;
 
 	if (spi_priv->has_thrpt_enh) {
-		ret = spi_internal_write(wilc, 0xe844 - WILC_SPI_REG_BASE,
+		return spi_internal_write(wilc, 0xe844 - WILC_SPI_REG_BASE,
 					 val);
-		return ret;
 	}
 
 	flags = val & (BIT(MAX_NUM_INT) - 1);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · Sanjana Sanikommu

The last two lines in the function could
be compressed into one. Avoid usage of local variable. Issue found with Coccinelle using ret.cocci.

---
 drivers/staging/wilc1000/wilc_spi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/wilc_spi.c +0 -0
index 4a1be9e60d74..9959a794edc7 100644

drivers/staging/wilc1000/wilc_spi.c static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status) · line 938

Quoted 6 lines
drivers/staging/wilc1000/wilc_spi.c +1 -1
@@ -934,9 +934,8 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
 	int k = IRG_FLAGS_OFFSET + 5;
 
 	if (spi_priv->has_thrpt_enh) {
-		ret = spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE,
+		return spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE,
 					int_status);

In this case and in the next one, the final argument needs to be moved one space to the right, because the function call has been moved one space to the right.

julia

Quoted 25 lines
drivers/staging/wilc1000/wilc_spi.c +1 -4
-		return ret;
 	}
 	ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, &byte_cnt);
 	if (!ret) {
@@ -982,9 +981,8 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
 	u32 tbl_ctl;
 
 	if (spi_priv->has_thrpt_enh) {
-		ret = spi_internal_write(wilc, 0xe844 - WILC_SPI_REG_BASE,
+		return spi_internal_write(wilc, 0xe844 - WILC_SPI_REG_BASE,
 					 val);
-		return ret;
 	}
 
 	flags = val & (BIT(MAX_NUM_INT) - 1);
--

2.17.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/20190328181046.30172-1-sanjana99reddy99%40gmail.com.
For more options, visit https://groups.google.com/d/optout.