Staging: mt7621-mmc: Remove ret.cocci warnings
Subsystems (2)
v6 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.
v6:
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
PATCH v6 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
@@ -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
Re: [PATCH v6 1/2] Staging: mt7621-mmc: Fix ret.cooci warnings
Quoted 16 lines · Bhanusree Pola
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;
@@(quoted diff) +1
-2-ret = +return e; -return ret;// </smpl>
Quoted 1 line
Signed-off-by Bhanusree Pola <[email protected]>
Quoted 27 lines
--- drivers/staging/mt7621-mmc/sd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/mt7621-mmc/sd.c +1
-3@@ -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)
PATCH v6 2/2 Staging: mt7621-mmc: Modify the return type of the function msdc_do_command
In reply to Bhanusree PolaModify 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
@@ -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