From: Guillaume Chazarain Date: Thu, 16 Aug 2007 16:18:53 +0000 (+0200) Subject: asus-laptop: Fix rmmod of asus_laptop X-Git-Tag: v2.6.23-rc4~16^2~12^2 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=commitdiff_plain;h=e1996a69e162b1c99c3d3802684d1c388b54f47d asus-laptop: Fix rmmod of asus_laptop The asus laptop driver conditionnaly registers leds in asus_led_register() depending on their availability, but unconditionnaly unregisters them all at exit time or when the module fails to load. Unregistering not registered leds result in the following Oops. So we should check before unregistering. [] do_page_fault+0x511/0x5e9 [] error_code+0x6a/0x70 [] device_unregister+0x26/0x32 [] led_classdev_unregister+0x58/0x94 [led_class] [] asus_led_exit+0x17/0x41 [asus_laptop] [] asus_laptop_exit+0xd/0x3f [asus_laptop] [] sys_delete_module+0x17b/0x1a2 [] sysenter_past_esp+0x6b/0xa1 EIP: [] device_del+0xb/0x23a SS:ESP 0068:f594ef0c Signed-off-by: Guillaume Chazarain Signed-off-by: Len Brown --- diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index d0fc4fd212e6..40db9f70148f 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c @@ -1072,7 +1072,8 @@ static void asus_backlight_exit(void) } #define ASUS_LED_UNREGISTER(object) \ - led_classdev_unregister(&object##_led) + if (object##_led.dev) \ + led_classdev_unregister(&object##_led) static void asus_led_exit(void) {