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

MIPS: Sanitise Cavium switch cases in TLB handler synthesizers

It makes no sense to fall through to `break'. Therefore reorder the
switch statements so as to have the Cavium cases first, followed by the
default case, which improves readability and pacifies code analysis
tools. No change in semantics, assembly produced is exactly the same.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: bc431d2153cc ("MIPS: Fix fall-through warnings for Clang")
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Maciej W. Rozycki and committed by
Thomas Bogendoerfer
6ddcba9d 244eae91

+10 -13
+10 -13
arch/mips/mm/tlbex.c
··· 2159 2159 uasm_i_tlbr(&p); 2160 2160 2161 2161 switch (current_cpu_type()) { 2162 - default: 2163 - if (cpu_has_mips_r2_exec_hazard) { 2164 - uasm_i_ehb(&p); 2165 - fallthrough; 2166 - 2167 2162 case CPU_CAVIUM_OCTEON: 2168 2163 case CPU_CAVIUM_OCTEON_PLUS: 2169 2164 case CPU_CAVIUM_OCTEON2: 2170 - break; 2171 - } 2165 + break; 2166 + default: 2167 + if (cpu_has_mips_r2_exec_hazard) 2168 + uasm_i_ehb(&p); 2169 + break; 2172 2170 } 2173 2171 2174 2172 /* Examine entrylo 0 or 1 based on ptr. */ ··· 2233 2235 uasm_i_tlbr(&p); 2234 2236 2235 2237 switch (current_cpu_type()) { 2236 - default: 2237 - if (cpu_has_mips_r2_exec_hazard) { 2238 - uasm_i_ehb(&p); 2239 - 2240 2238 case CPU_CAVIUM_OCTEON: 2241 2239 case CPU_CAVIUM_OCTEON_PLUS: 2242 2240 case CPU_CAVIUM_OCTEON2: 2243 - break; 2244 - } 2241 + break; 2242 + default: 2243 + if (cpu_has_mips_r2_exec_hazard) 2244 + uasm_i_ehb(&p); 2245 + break; 2245 2246 } 2246 2247 2247 2248 /* Examine entrylo 0 or 1 based on ptr. */