Skip to contentSkip to conversation

asus_acpi: fix oops on non-asus machines

PATCH New Maxime Austruy 1 participant 1 message Jun 5, 2007 ACPI

lore
Share & tools
lore
#0 lore raw

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.

--

 drivers/acpi/asus_acpi.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/asus_acpi.c +2 -1
index 6d7d415..3cd79ca 100644
@@ -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;