block: Add fallthrough markers to switch statements
authorBart Van Assche <bart.vanassche@wdc.com>
Wed, 21 Jun 2017 16:40:11 +0000 (09:40 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 21 Jun 2017 17:46:07 +0000 (11:46 -0600)
This patch suppresses gcc 7 warnings about falling through in switch
statements when building with W=1. From the gcc documentation: The
-Wimplicit-fallthrough=3 warning is enabled by -Wextra. See also
https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Warning-Options.html.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/badblocks.c
block/elevator.c
block/ioprio.c

index 6ebcef28231486ae2b9dcefadfe61412b2112f11..43c71166e1e2a644b0c59fecdd178524de5e6b4a 100644 (file)
@@ -533,6 +533,7 @@ ssize_t badblocks_store(struct badblocks *bb, const char *page, size_t len,
        case 3:
                if (newline != '\n')
                        return -EINVAL;
+               /* fall through */
        case 2:
                if (length <= 0)
                        return -EINVAL;
index dac99fbfc273f36234b95f80feb711173fdf41e7..4bb2f0c93fa6c09df2e52f77c09832744d10d940 100644 (file)
@@ -681,6 +681,7 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where)
                 */
                if (elv_attempt_insert_merge(q, rq))
                        break;
+               /* fall through */
        case ELEVATOR_INSERT_SORT:
                BUG_ON(blk_rq_is_passthrough(rq));
                rq->rq_flags |= RQF_SORTED;
index 4b120c9cf7e8b1bd5ce45a55371454d9785f0c37..6f5d0b6625e39b930d93aca15082daec481f0199 100644 (file)
@@ -75,7 +75,8 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
                case IOPRIO_CLASS_RT:
                        if (!capable(CAP_SYS_ADMIN))
                                return -EPERM;
-                       /* fall through, rt has prio field too */
+                       /* fall through */
+                       /* rt has prio field too */
                case IOPRIO_CLASS_BE:
                        if (data >= IOPRIO_BE_NR || data < 0)
                                return -EINVAL;