[MIPS] Add BUG_ON assertion for attempt to run kernel on the wrong CPU type.
authorFranck Bui-Huu <vagabon.xyz@gmail.com>
Mon, 8 Oct 2007 14:11:51 +0000 (16:11 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 11 Oct 2007 22:46:18 +0000 (23:46 +0100)
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/cpu-probe.c

index 234c7f5005fb323639558cec66a52166566396bd..c8c47a2d1972f5cb6c3a8dadd155ea32206b634a 100644 (file)
@@ -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();