asus-laptop: Fix rmmod of asus_laptop
authorGuillaume Chazarain <guichaz@yahoo.fr>
Thu, 16 Aug 2007 16:18:53 +0000 (18:18 +0200)
committerLen Brown <len.brown@intel.com>
Fri, 24 Aug 2007 05:07:30 +0000 (01:07 -0400)
commite1996a69e162b1c99c3d3802684d1c388b54f47d
treebce0306d79d4b282ecc7629803eda2072ec20321
parentb377fd3982ad957c796758a90e2988401a884241
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.

 [<c032d2f9>] do_page_fault+0x511/0x5e9
 [<c032bae2>] error_code+0x6a/0x70
 [<c026abf8>] device_unregister+0x26/0x32
 [<f8864218>] led_classdev_unregister+0x58/0x94 [led_class]
 [<f88a90f8>] asus_led_exit+0x17/0x41 [asus_laptop]
 [<f88a91c9>] asus_laptop_exit+0xd/0x3f [asus_laptop]
 [<c013cee1>] sys_delete_module+0x17b/0x1a2
 [<c0106eae>] sysenter_past_esp+0x6b/0xa1

EIP: [<c026a9a3>] device_del+0xb/0x23a SS:ESP 0068:f594ef0c

Signed-off-by: Guillaume Chazarain <guichaz@yahoo.fr>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/misc/asus-laptop.c