Commit 3bf2ff67 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: Suppress gcc 7 fall-through warnings reported with W=1

The conclusion of a recent discussion about the new warnings
reported by gcc 7 is that the new warnings reported when building
with W=1 should be suppressed. However, gcc 7 still warns about
fall-through in switch statements when building with W=1. Suppress
these warnings by annotating the SCSI core properly.

See also Linus Torvalds, Lots of new warnings with gcc-7.1.1, 11
July 2017 (https://www.mail-archive.com/linux-media@vger.kernel.org/msg115428.html).

References: commit bd664f6b ("disable new gcc-7.1.1 warnings for now")
Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c2e872a2
...@@ -552,6 +552,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd) ...@@ -552,6 +552,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
set_host_byte(scmd, DID_ALLOC_FAILURE); set_host_byte(scmd, DID_ALLOC_FAILURE);
return SUCCESS; return SUCCESS;
} }
/* FALLTHROUGH */
case COPY_ABORTED: case COPY_ABORTED:
case VOLUME_OVERFLOW: case VOLUME_OVERFLOW:
case MISCOMPARE: case MISCOMPARE:
...@@ -573,6 +574,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd) ...@@ -573,6 +574,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
return ADD_TO_MLQUEUE; return ADD_TO_MLQUEUE;
else else
set_host_byte(scmd, DID_TARGET_FAILURE); set_host_byte(scmd, DID_TARGET_FAILURE);
/* FALLTHROUGH */
case ILLEGAL_REQUEST: case ILLEGAL_REQUEST:
if (sshdr.asc == 0x20 || /* Invalid command operation code */ if (sshdr.asc == 0x20 || /* Invalid command operation code */
...@@ -683,6 +685,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd) ...@@ -683,6 +685,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
switch (status_byte(scmd->result)) { switch (status_byte(scmd->result)) {
case GOOD: case GOOD:
scsi_handle_queue_ramp_up(scmd->device); scsi_handle_queue_ramp_up(scmd->device);
/* FALLTHROUGH */
case COMMAND_TERMINATED: case COMMAND_TERMINATED:
return SUCCESS; return SUCCESS;
case CHECK_CONDITION: case CHECK_CONDITION:
...@@ -1734,6 +1737,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) ...@@ -1734,6 +1737,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
set_host_byte(scmd, DID_TIME_OUT); set_host_byte(scmd, DID_TIME_OUT);
return SUCCESS; return SUCCESS;
} }
/* FALLTHROUGH */
case DID_NO_CONNECT: case DID_NO_CONNECT:
case DID_BAD_TARGET: case DID_BAD_TARGET:
/* /*
...@@ -1819,6 +1823,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) ...@@ -1819,6 +1823,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
* the case of trying to send too many commands to a * the case of trying to send too many commands to a
* tagged queueing device. * tagged queueing device.
*/ */
/* FALLTHROUGH */
case BUSY: case BUSY:
/* /*
* device can't talk to us at the moment. Should only * device can't talk to us at the moment. Should only
...@@ -1831,6 +1836,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) ...@@ -1831,6 +1836,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
if (scmd->cmnd[0] == REPORT_LUNS) if (scmd->cmnd[0] == REPORT_LUNS)
scmd->device->sdev_target->expecting_lun_change = 0; scmd->device->sdev_target->expecting_lun_change = 0;
scsi_handle_queue_ramp_up(scmd->device); scsi_handle_queue_ramp_up(scmd->device);
/* FALLTHROUGH */
case COMMAND_TERMINATED: case COMMAND_TERMINATED:
return SUCCESS; return SUCCESS;
case TASK_ABORTED: case TASK_ABORTED:
...@@ -2320,8 +2326,8 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg) ...@@ -2320,8 +2326,8 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
rtn = scsi_try_host_reset(scmd); rtn = scsi_try_host_reset(scmd);
if (rtn == SUCCESS) if (rtn == SUCCESS)
break; break;
default:
/* FALLTHROUGH */ /* FALLTHROUGH */
default:
rtn = FAILED; rtn = FAILED;
break; break;
} }
......
...@@ -116,13 +116,15 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, ...@@ -116,13 +116,15 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
case NOT_READY: /* This happens if there is no disc in drive */ case NOT_READY: /* This happens if there is no disc in drive */
if (sdev->removable) if (sdev->removable)
break; break;
/* FALLTHROUGH */
case UNIT_ATTENTION: case UNIT_ATTENTION:
if (sdev->removable) { if (sdev->removable) {
sdev->changed = 1; sdev->changed = 1;
result = 0; /* This is no longer considered an error */ result = 0; /* This is no longer considered an error */
break; break;
} }
default: /* Fall through for non-removable media */ /* FALLTHROUGH -- for non-removable media */
default:
sdev_printk(KERN_INFO, sdev, sdev_printk(KERN_INFO, sdev,
"ioctl_internal_command return code = %x\n", "ioctl_internal_command return code = %x\n",
result); result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment