m68k: Some input drivers do not check the platform
authorGeert Uytterhoeven <geert@linux-m68k.org>
Sun, 18 May 2008 18:47:17 +0000 (20:47 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 18 May 2008 20:28:49 +0000 (13:28 -0700)
Some input drivers do not check whether they're actually running on the
correct platform, causing multi-platform kernels to crash if they are not.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/input/keyboard/hilkbd.c
drivers/input/misc/hp_sdc_rtc.c
drivers/input/serio/hp_sdc_mlc.c

index 50d80ecf0b80915ee81d2ab5c59b01be9cb1c4b7..aacf71f3cd44b0557af0af0549a4fee2e81dfdf3 100644 (file)
@@ -217,6 +217,10 @@ hil_keyb_init(void)
                return -ENOMEM;
 
 #if defined(CONFIG_HP300)
+       if (!MACH_IS_HP300) {
+               err = -ENODEV;
+               goto err1;
+       }
        if (!hwreg_present((void *)(HILBASE + HIL_DATA))) {
                printk(KERN_ERR "HIL: hardware register was not found\n");
                err = -ENODEV;
index ab76ea442fa56140a89d58df87cc934e1073ab2f..45e5d05b01dee4cfd674bf9beae2c5b55cf48808 100644 (file)
@@ -691,6 +691,11 @@ static int __init hp_sdc_rtc_init(void)
 {
        int ret;
 
+#ifdef __mc68000__
+       if (!MACH_IS_HP300)
+               return -ENODEV;
+#endif
+
        init_MUTEX(&i8042tregs);
 
        if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr)))
index f1fd3b638a379edecc0fb70a2d575498d2f09b64..587398f5c9df30efd0a5735056ec0eac2eb7b227 100644 (file)
@@ -306,6 +306,11 @@ static int __init hp_sdc_mlc_init(void)
 {
        hil_mlc *mlc = &hp_sdc_mlc;
 
+#ifdef __mc68000__
+       if (!MACH_IS_HP300)
+               return -ENODEV;
+#endif
+
        printk(KERN_INFO PREFIX "Registering the System Domain Controller's HIL MLC.\n");
 
        hp_sdc_mlc_priv.emtestmode = 0;