Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 bd664f6b3e37 ("disable new gcc-7.1.1 warnings for now")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
3bf2ff67 c2e872a2

+10 -2
+7 -1
drivers/scsi/scsi_error.c
··· 552 552 set_host_byte(scmd, DID_ALLOC_FAILURE); 553 553 return SUCCESS; 554 554 } 555 + /* FALLTHROUGH */ 555 556 case COPY_ABORTED: 556 557 case VOLUME_OVERFLOW: 557 558 case MISCOMPARE: ··· 574 573 return ADD_TO_MLQUEUE; 575 574 else 576 575 set_host_byte(scmd, DID_TARGET_FAILURE); 576 + /* FALLTHROUGH */ 577 577 578 578 case ILLEGAL_REQUEST: 579 579 if (sshdr.asc == 0x20 || /* Invalid command operation code */ ··· 685 683 switch (status_byte(scmd->result)) { 686 684 case GOOD: 687 685 scsi_handle_queue_ramp_up(scmd->device); 686 + /* FALLTHROUGH */ 688 687 case COMMAND_TERMINATED: 689 688 return SUCCESS; 690 689 case CHECK_CONDITION: ··· 1737 1734 set_host_byte(scmd, DID_TIME_OUT); 1738 1735 return SUCCESS; 1739 1736 } 1737 + /* FALLTHROUGH */ 1740 1738 case DID_NO_CONNECT: 1741 1739 case DID_BAD_TARGET: 1742 1740 /* ··· 1823 1819 * the case of trying to send too many commands to a 1824 1820 * tagged queueing device. 1825 1821 */ 1822 + /* FALLTHROUGH */ 1826 1823 case BUSY: 1827 1824 /* 1828 1825 * device can't talk to us at the moment. Should only ··· 1836 1831 if (scmd->cmnd[0] == REPORT_LUNS) 1837 1832 scmd->device->sdev_target->expecting_lun_change = 0; 1838 1833 scsi_handle_queue_ramp_up(scmd->device); 1834 + /* FALLTHROUGH */ 1839 1835 case COMMAND_TERMINATED: 1840 1836 return SUCCESS; 1841 1837 case TASK_ABORTED: ··· 2326 2320 rtn = scsi_try_host_reset(scmd); 2327 2321 if (rtn == SUCCESS) 2328 2322 break; 2329 - default: 2330 2323 /* FALLTHROUGH */ 2324 + default: 2331 2325 rtn = FAILED; 2332 2326 break; 2333 2327 }
+3 -1
drivers/scsi/scsi_ioctl.c
··· 116 116 case NOT_READY: /* This happens if there is no disc in drive */ 117 117 if (sdev->removable) 118 118 break; 119 + /* FALLTHROUGH */ 119 120 case UNIT_ATTENTION: 120 121 if (sdev->removable) { 121 122 sdev->changed = 1; 122 123 result = 0; /* This is no longer considered an error */ 123 124 break; 124 125 } 125 - default: /* Fall through for non-removable media */ 126 + /* FALLTHROUGH -- for non-removable media */ 127 + default: 126 128 sdev_printk(KERN_INFO, sdev, 127 129 "ioctl_internal_command return code = %x\n", 128 130 result);