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

x86/kernel: Mark expected switch-case fall-throughs

In preparation to enable -Wimplicit-fallthrough by default, mark
switch-case statements where fall-through is intentional, explicitly in
order to fix a couple of -Wimplicit-fallthrough warnings.

Warning level 3 was used: -Wimplicit-fallthrough=3.

[ bp: Massasge and trim commit message. ]

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: David Wang <davidwang@zhaoxin.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Nicolai Stange <nstange@suse.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Pu Wen <puwen@hygon.cn>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190125183903.GA4712@embeddedor

authored by

Gustavo A. R. Silva and committed by
Borislav Petkov
6fcebf13 89da3446

+6
+2
arch/x86/kernel/apic/io_apic.c
··· 812 812 return IOAPIC_POL_HIGH; 813 813 case MP_IRQPOL_RESERVED: 814 814 pr_warn("IOAPIC: Invalid polarity: 2, defaulting to low\n"); 815 + /* fall through */ 815 816 case MP_IRQPOL_ACTIVE_LOW: 816 817 default: /* Pointless default required due to do gcc stupidity */ 817 818 return IOAPIC_POL_LOW; ··· 860 859 return IOAPIC_EDGE; 861 860 case MP_IRQTRIG_RESERVED: 862 861 pr_warn("IOAPIC: Invalid trigger mode 2 defaulting to level\n"); 862 + /* fall through */ 863 863 case MP_IRQTRIG_LEVEL: 864 864 default: /* Pointless default required due to do gcc stupidity */ 865 865 return IOAPIC_LEVEL;
+1
arch/x86/kernel/cpu/cacheinfo.c
··· 248 248 switch (leaf) { 249 249 case 1: 250 250 l1 = &l1i; 251 + /* fall through */ 251 252 case 0: 252 253 if (!l1->val) 253 254 return;
+1
arch/x86/kernel/hw_breakpoint.c
··· 279 279 hw->len = X86_BREAKPOINT_LEN_X; 280 280 return 0; 281 281 } 282 + /* fall through */ 282 283 default: 283 284 return -EINVAL; 284 285 }
+1
arch/x86/kernel/kgdb.c
··· 467 467 ptr = &remcomInBuffer[1]; 468 468 if (kgdb_hex2long(&ptr, &addr)) 469 469 linux_regs->ip = addr; 470 + /* fall through */ 470 471 case 'D': 471 472 case 'k': 472 473 /* clear the trace bit */
+1
arch/x86/kernel/uprobes.c
··· 745 745 * OPCODE1() of the "short" jmp which checks the same condition. 746 746 */ 747 747 opc1 = OPCODE2(insn) - 0x10; 748 + /* fall through */ 748 749 default: 749 750 if (!is_cond_jmp_opcode(opc1)) 750 751 return -ENOSYS;