Staging: mt7621-mmc: Remove ret.cocci warnings
Subsystems (2)
v3 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.
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 v3 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
PATCH v3 2/2 Staging: mt7621-mmc: Modify the return type for all possible values
In reply to Bhanusree Pola-Change the return type in function prototype and function definition of the function msdc_do_command
-Change to static int from static unsigned int as the member error of the structure struct mmc_command is of type int.
-Align the arguments to match the open parenthesis.
--- 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
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: mt7621-mmc: Modify the return type for all possible values
Quoted 4 lines · Bhanusree Pola
-Change the return type in function prototype and function definition of the function
msdc_do_command
-Change to static int from static unsigned int as the member error of the structure structmmc_commandis of type int.
The explanation doesn't flow very well. It looks like the second point justifies the change described in the first point. The -s are not really a good idea. They force the reader to guess how the two pieces of information are related. You should explain this. Explain what is the relevance of the error field.
Quoted 1 line
-Align the arguments to match the open parenthesis.
You don't have to mention this, because you are fixing a problem that you caused.
julia
Quoted 50 lines
Signed-off-by Bhanusree Pola <[email protected]>--- drivers/staging/mt7621-mmc/sd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/staging/mt7621-mmc/sd.c +8
-9@@ -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; --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/20190316172404.10694-3-bhanusreemahesh%40gmail.com.
For more options, visit https://groups.google.com/d/optout.