]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/bay.c
bay: exit if notify handler cannot be installed
[linux-2.6-omap-h63xx.git] / drivers / acpi / bay.c
index d2fc94161848ff91e424b08df40f5a0d9643aafe..26038c2a2a71bb20026a0631e890b6d57705805e 100644 (file)
@@ -301,16 +301,20 @@ static int bay_add(acpi_handle handle, int id)
         */
        pdev->dev.uevent_suppress = 0;
 
-       if (acpi_bay_add_fs(new_bay)) {
-               platform_device_unregister(new_bay->pdev);
-               goto bay_add_err;
-       }
-
        /* register for events on this device */
        status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
                        bay_notify, new_bay);
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Error installing bay notify handler\n");
+               printk(KERN_INFO PREFIX "Error installing bay notify handler\n");
+               platform_device_unregister(new_bay->pdev);
+               goto bay_add_err;
+       }
+
+       if (acpi_bay_add_fs(new_bay)) {
+               acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
+                                          bay_notify);
+               platform_device_unregister(new_bay->pdev);
+               goto bay_add_err;
        }
 
        /* if we are on a dock station, we should register for dock