* [PATCH v4 1/2] Staging: mt7621-mmc: Fix ret.cooci warnings
2019-03-17 3:13 [PATCH v4 0/2] Staging: mt7621-mmc: Remove ret.cocci warnings Bhanusree Pola
@ 2019-03-17 3:13 ` Bhanusree Pola
2019-03-17 3:13 ` [PATCH v4 2/2] Staging: mt7621-mmc: Modify the return type for all possible values Bhanusree Pola
1 sibling, 0 replies; 4+ messages in thread
From: Bhanusree Pola @ 2019-03-17 3:13 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Greg Kroah-Hartman, Matthias Brugger
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>
Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
---
drivers/staging/mt7621-mmc/sd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 4b26ec896a96..8857cdb9dafd 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -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)
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v4 2/2] Staging: mt7621-mmc: Modify the return type for all possible values
2019-03-17 3:13 [PATCH v4 0/2] Staging: mt7621-mmc: Remove ret.cocci warnings Bhanusree Pola
2019-03-17 3:13 ` [PATCH v4 1/2] Staging: mt7621-mmc: Fix ret.cooci warnings Bhanusree Pola
@ 2019-03-17 3:13 ` Bhanusree Pola
2019-03-17 10:19 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Bhanusree Pola @ 2019-03-17 3:13 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Greg Kroah-Hartman, Matthias Brugger
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.
Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
---
drivers/staging/mt7621-mmc/sd.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 8857cdb9dafd..049b312131a9 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread