* [PATCH -next] scsi: Remove ignoring unreachable code warning
@ 2022-03-01 8:04 Yang Li
2022-03-19 3:57 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2022-03-01 8:04 UTC (permalink / raw)
To: jejb; +Cc: martin.petersen, linux-scsi, linux-kernel, Yang Li, Abaci Robot
The smatch tool reported the following warning:
drivers/scsi/scsi_error.c:1988 scsi_decide_disposition() warn: ignoring
unreachable code.
Remove the "default:return FAILED;" instead of "return FAILED;" reported
by smatch, because compilers can provide more useful diagnostics about
switch/case statements that do not have a default statement, especially
if the "switch" applies to a value with enumeration type.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
drivers/scsi/scsi_error.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 9c237b223e63..ee752b4512f8 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1982,8 +1982,6 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd)
"reservation conflict\n");
set_host_byte(scmd, DID_NEXUS_FAILURE);
return SUCCESS; /* causes immediate i/o error */
- default:
- return FAILED;
}
return FAILED;
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] scsi: Remove ignoring unreachable code warning
2022-03-01 8:04 [PATCH -next] scsi: Remove ignoring unreachable code warning Yang Li
@ 2022-03-19 3:57 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2022-03-19 3:57 UTC (permalink / raw)
To: jejb, Yang Li; +Cc: Martin K . Petersen, linux-kernel, linux-scsi, Abaci Robot
On Tue, 1 Mar 2022 16:04:48 +0800, Yang Li wrote:
> The smatch tool reported the following warning:
> drivers/scsi/scsi_error.c:1988 scsi_decide_disposition() warn: ignoring
> unreachable code.
>
> Remove the "default:return FAILED;" instead of "return FAILED;" reported
> by smatch, because compilers can provide more useful diagnostics about
> switch/case statements that do not have a default statement, especially
> if the "switch" applies to a value with enumeration type.
>
> [...]
Applied to 5.18/scsi-queue, thanks!
[1/1] scsi: Remove ignoring unreachable code warning
https://git.kernel.org/mkp/scsi/c/e1b353e7a31d
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-19 3:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01 8:04 [PATCH -next] scsi: Remove ignoring unreachable code warning Yang Li
2022-03-19 3:57 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox