Skip to contentSkip to conversation

Staging: mt7621-mmc: Remove ret.cocci warnings

PATCH Superseded Bhanusree Pola 1 participant 3 messages Mar 17, 2019

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

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

This patch series does the following:
[PATCH 1/2]:clears the ret.cocci warnings and removes unused locl variables.
[PATCH 2/2]:Modifies the data type of the function for all possible values.

v2:
-dropped patch series and did all the changes in same patch as the
first patch introduced the problem.
-Commit log modified.

v3:
PATCH[1/2] Commit log modified.
PATCH[2/2] included to modify the data type of the function for all possible
values by maintaing the alignment of parenthesis.

v4:
PATCH[2/2] commit log modified.

v5:
PATCH[2/2] Subject line modified.

Bhanusree Pola (2):
Staging: mt7621-mmc: Fix ret.cooci warnings
Staging: mt7621-mmc: Modify the return type for all possible values

 drivers/staging/mt7621-mmc/sd.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

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

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

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

-ret =
+return

     e;

-return ret;
// </smpl>

---
 drivers/staging/mt7621-mmc/sd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/mt7621-mmc/sd.c +1 -3
index 4b26ec896a96..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;
@@ -763,8 +762,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

PATCH v5 2/2 Staging: mt7621-mmc: Modify the return type of

In reply to Bhanusree Pola

Modify the return type of the function msdc_do_command to static int as the member error of the structure struct mmc_command is of type int.

---
 drivers/staging/mt7621-mmc/sd.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/mt7621-mmc/sd.c +8 -8
index 8857cdb9dafd..049b312131a9 100644
@@ -168,10 +168,10 @@ static u32 hclks[] = {50000000}; /* +/- by chhung */
 #define PHYSADDR(a)             ((a) & 0x1fffffff)
 #endif
 /* end of +++ */
-static unsigned int msdc_do_command(struct msdc_host   *host,
-				    struct mmc_command *cmd,
-				    int                 tune,
-				    unsigned long       timeout);
+static int msdc_do_command(struct msdc_host   *host,
+		           struct mmc_command *cmd,
+			   int                 tune,
+		           unsigned long       timeout);
 
 static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd);
 
@@ -535,10 +535,10 @@ static unsigned int msdc_command_resp(struct msdc_host   *host,
 	return cmd->error;
 }
 
-static unsigned int msdc_do_command(struct msdc_host   *host,
-				    struct mmc_command *cmd,
-				    int                 tune,
-				    unsigned long       timeout)
+static int msdc_do_command(struct msdc_host   *host,
+			   struct mmc_command *cmd,
+			   int                 tune,
+		           unsigned long       timeout)
 {
 	if (msdc_command_start(host, cmd, timeout))
 		goto end;
Signature · 1 line
2.17.1