From: Franck Bui-Huu Date: Mon, 8 Oct 2007 14:11:51 +0000 (+0200) Subject: [MIPS] Add BUG_ON assertion for attempt to run kernel on the wrong CPU type. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dec8b1ca990055f3a8954ac3bc98fdb785af52e4;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [MIPS] Add BUG_ON assertion for attempt to run kernel on the wrong CPU type. Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 234c7f5005fb..c8c47a2d1972 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -922,6 +922,14 @@ __init void cpu_probe(void) default: c->cputype = CPU_UNKNOWN; } + + /* + * Platform code can force the cpu type to optimize code + * generation. In that case be sure the cpu type is correctly + * manually setup otherwise it could trigger some nasty bugs. + */ + BUG_ON(current_cpu_type() != c->cputype); + if (c->options & MIPS_CPU_FPU) { c->fpu_id = cpu_get_fpu_id();