Skip to contentSkip to conversation

Staging: mt7621-mmc: Remove ret.cocci warnings

PATCH Superseded Bhanusree Pola 2 participants 6 messages Mar 16, 2019

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Staging: mt7621-mmc: Remove ret.cocci warnings

This patch series clears the ret.cocci warnings and removes unused locl variables.

Bhanusree Pola (2):
Staging: mt7621-mmc: Fix ret.cooci warnings
Staging: mt7621-mmc: Remove unused local variable

 drivers/staging/mt7621-mmc/sd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 Staging: mt7621-mmc: Fix ret.cooci warnings

Return the value directly instead of storing it in local variable err. The semantic patch that fixes this problem is as follows

// <smpl>
@@
local idexpression ret;
expression e;
@@

-ret =
+return

     e;

-return ret;
// </smpl>

---
 drivers/staging/mt7621-mmc/sd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/mt7621-mmc/sd.c +1 -2
index 4b26ec896a96..5943e95ed1c3 100644
@@ -763,8 +763,7 @@ static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host)
 	mrq.cmd = &cmd; cmd.mrq = &mrq;
 	cmd.data = NULL;
 
-	err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
-	return err;
+	return msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
 }
 
 static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd)
Signature · 1 line
2.17.1
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: mt7621-mmc: Fix ret.cooci warnings

Quoted 2 lines · Bhanusree Pola

Return the value directly instead of storing it in local variable err. The semantic patch that fixes this problem is as follows

You can drop the now unused variable in this patch too. This patch introduced the problem, so it would be better for all patches to leave the kernel in a reasonable state.

julia

Quoted 42 lines

// <smpl>
@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;

// </smpl>

---
 drivers/staging/mt7621-mmc/sd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/mt7621-mmc/sd.c +1 -3
index 4b26ec896a96..5943e95ed1c3 100644
@@ -763,8 +763,7 @@ static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host)
 	mrq.cmd = &cmd; cmd.mrq = &mrq;
 	cmd.data = NULL;
 
-	err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
-	return err;
+	return msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
 }
 
 static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd)
--

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/20190316144812.7427-2-bhanusreemahesh%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: mt7621-mmc: Fix ret.cooci warnings

Quoted 11 lines · Julia Lawall
Quoted 2 lines · Bhanusree Pola

Return the value directly instead of storing it in local variable err. The semantic patch that fixes this problem is as follows

You can drop the now unused variable in this patch too. This patch introduced the problem, so it would be better for all patches to leave the kernel in a reasonable state.

This was automatically done by using --in-place flag. so i removed unused variable in the next patch.
Do you want me to do both in same patch and resend?

Bhanusree

Quoted 52 lines

julia

Quoted 35 lines

// <smpl>
@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;

// </smpl>

---
 drivers/staging/mt7621-mmc/sd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/mt7621-mmc/sd.c +1 -3
index 4b26ec896a96..5943e95ed1c3 100644
@@ -763,8 +763,7 @@ static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host)
      mrq.cmd = &cmd; cmd.mrq = &mrq;
      cmd.data = NULL;
 
-     err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
-     return err;
+     return msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
 }
 
 static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd)
--

2.17.1

Quoted 7 lines

--
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/20190316144812.7427-2-bhanusreemahesh%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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/alpine.DEB.2.21.1903161556580.2487%40hadrien.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: mt7621-mmc: Fix ret.cooci warnings

Quoted 9 lines · Bhanusree Mahesh
Quoted 8 lines · Julia Lawall
Quoted 2 lines · Bhanusree Pola

Return the value directly instead of storing it in local variable err. The semantic patch that fixes this problem is as follows

Quoted 7 lines
Quoted 3 lines

You can drop the now unused variable in this patch too. This patch introduced the problem, so it would be better for all patches to leave the kernel in a reasonable state.

This was automatically done by using --in-place flag. so i removed unused variable in the next patch.
Do you want me to do both in same patch and resend?

Yes, please.

julia

Quoted 55 lines

Bhanusree

Quoted 52 lines

julia

Quoted 35 lines

// <smpl>
@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;

// </smpl>

---
 drivers/staging/mt7621-mmc/sd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/mt7621-mmc/sd.c +1 -3
index 4b26ec896a96..5943e95ed1c3 100644
@@ -763,8 +763,7 @@ static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host)
      mrq.cmd = &cmd; cmd.mrq = &mrq;
      cmd.data = NULL;
 
-     err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
-     return err;
+     return msdc_do_command(host, &cmd, 0, CMD_TIMEOUT);
 }
 
 static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd)
--

2.17.1

Quoted 7 lines

--
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/20190316144812.7427-2-bhanusreemahesh%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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/alpine.DEB.2.21.1903161556580.2487%40hadrien.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw

PATCH 2/2 Staging: mt7621-mmc: Remove unused local variable

In reply to Bhanusree Pola

Remove the unused local variable err.

---
 drivers/staging/mt7621-mmc/sd.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/mt7621-mmc/sd.c +0 -1
index 5943e95ed1c3..8857cdb9dafd 100644
@@ -752,7 +752,6 @@ static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host)
 {
 	struct mmc_command cmd;
 	struct mmc_request mrq;
-	u32 err;
 
 	memset(&cmd, 0, sizeof(struct mmc_command));
 	cmd.opcode = MMC_APP_CMD;
Signature · 1 line
2.17.1