Skip to content

Commit 6ddcba9

Browse files
maciej-w-rozyckitsbogend
authored andcommitted
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: bc431d2 ("MIPS: Fix fall-through warnings for Clang") Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 244eae9 commit 6ddcba9

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

arch/mips/mm/tlbex.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,16 +2159,14 @@ static void build_r4000_tlb_load_handler(void)
21592159
uasm_i_tlbr(&p);
21602160

21612161
switch (current_cpu_type()) {
2162-
default:
2163-
if (cpu_has_mips_r2_exec_hazard) {
2164-
uasm_i_ehb(&p);
2165-
fallthrough;
2166-
21672162
case CPU_CAVIUM_OCTEON:
21682163
case CPU_CAVIUM_OCTEON_PLUS:
21692164
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;
21722170
}
21732171

21742172
/* Examine entrylo 0 or 1 based on ptr. */
@@ -2235,15 +2233,14 @@ static void build_r4000_tlb_load_handler(void)
22352233
uasm_i_tlbr(&p);
22362234

22372235
switch (current_cpu_type()) {
2238-
default:
2239-
if (cpu_has_mips_r2_exec_hazard) {
2240-
uasm_i_ehb(&p);
2241-
22422236
case CPU_CAVIUM_OCTEON:
22432237
case CPU_CAVIUM_OCTEON_PLUS:
22442238
case CPU_CAVIUM_OCTEON2:
2245-
break;
2246-
}
2239+
break;
2240+
default:
2241+
if (cpu_has_mips_r2_exec_hazard)
2242+
uasm_i_ehb(&p);
2243+
break;
22472244
}
22482245

22492246
/* Examine entrylo 0 or 1 based on ptr. */

0 commit comments

Comments
 (0)