Re: [PATCH 002/117] Introduce enums for the SAM, message, host and driver status codes

Bart Van Assche
2021-04-20T14:59:44Z

On 4/20/21 2:23 AM, Steffen Maier wrote:
> On 4/20/21 2:06 AM, Bart Van Assche wrote:
>> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
>> index 9afd65eb2c8b..54213c37806b 100644
>> --- a/drivers/scsi/scsi_error.c
>> +++ b/drivers/scsi/scsi_error.c
>> @@ -1775,6 +1775,8 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
>>           fallthrough;
>>       case DID_SOFT_ERROR:
>>           return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER);
>> +    default:
>> +        break;
>
> Remind me, what are the compiler warnings we use during build?
> Adding a default case seems OK for me if we use -Wswitch-enum, but I'm
> not sure if we only have -Wswitch because then we would not get static
> build warnings if we ever were to add new enum values but forgot to
> address them here?
Hi Steffen,

I think -Wall is enabled by default and also that -Wall implies -Wswitch
but not -Wswitch-enum.

If you want I can change the "default:" label above into an explicit
list of error codes that are not handled.

Thanks,

Bart.