diff mbox series

scsi: Remove unreachable code

Message ID 1562234156-11945-1-git-send-email-dingxiang@cmss.chinamobile.com (mailing list archive)
State Changes Requested
Headers show
Series scsi: Remove unreachable code | expand

Commit Message

Ding Xiang July 4, 2019, 9:55 a.m. UTC
The return code after switch default is unreachable,
so remove it.

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 drivers/scsi/scsi_error.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Bart Van Assche July 8, 2019, 3:04 p.m. UTC | #1
On 7/4/19 2:55 AM, Ding Xiang wrote:
> The return code after switch default is unreachable,
> so remove it.
> 
> Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
> ---
>   drivers/scsi/scsi_error.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index bfa569f..12180f0 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -1909,7 +1909,6 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
>   	default:
>   		return FAILED;
>   	}
> -	return FAILED;

I'd rather remove the "default: return FAILED;" code than make the above 
change. If status_byte() ever would be changed into an inline function 
that returns an enum then my alternative will allow the compiler to 
verify whether all enum labels have been handled. No such check will be 
performed if the above patch would be applied.

Bart.
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index bfa569f..12180f0 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1909,7 +1909,6 @@  int scsi_decide_disposition(struct scsi_cmnd *scmd)
 	default:
 		return FAILED;
 	}
-	return FAILED;
 
 maybe_retry: