asus_acpi: fix oops on non-asus machines
PATCH 1/1 asus_acpi: fix oops on non-asus machines
This change fixes an oops when rmmod'ing the asus_acpi module on non-asus machine. Inspection of the code nearby also unveiled a problem in the error path of backlight_device_register, so this fixes it too.
Signed-off-by Maxime Austruy <[email protected]>
--
drivers/acpi/asus_acpi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/asus_acpi.c +2 -1
@@ -1398,7 +1398,7 @@ static int __init asus_acpi_init(void)if (!asus_hotk_found) {acpi_bus_unregister_driver (&asus_hotk_driver);remove_proc_entry (PROC_ASUS , acpi_root_dir); -return result; +return -ENODEV ; } asus_backlight_device = backlight_device_register("asus",NULL,NULL,
@@ -1407,6 +1407,7 @@ static int __init asus_acpi_init(void)printk (KERN_ERR "Could not register asus backlight device\n" ); asus_backlight_device =NULL ;asus_acpi_exit (); +return -ENODEV ; } asus_backlight_device->props.max_brightness =15 ;