summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-06-22 16:17:38 +0800
committerMatthew Garrett <mjg@redhat.com>2010-08-03 09:48:48 -0400
commit1c79632bd011de84f32dcdf7d92b65bb61b1e6da (patch)
tree1979524674de695dbe9b1f083c6261dd95a0bc8e /drivers/platform
parente9ec7f3539cbeae8ffc5d7b30543e5612df5cba3 (diff)
acer-wmi: fix resource reclaim in acer_wmi_init error path
This patch fixes the resource reclaim in acer_wmi_init error path. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/acer-wmi.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 1ea6c434d33..ae79624a692 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1327,22 +1327,31 @@ static int __init acer_wmi_init(void)
"generic video driver\n");
}
- if (platform_driver_register(&acer_platform_driver)) {
+ err = platform_driver_register(&acer_platform_driver);
+ if (err) {
printk(ACER_ERR "Unable to register platform driver.\n");
goto error_platform_register;
}
+
acer_platform_device = platform_device_alloc("acer-wmi", -1);
- platform_device_add(acer_platform_device);
+ if (!acer_platform_device) {
+ err = -ENOMEM;
+ goto error_device_alloc;
+ }
+
+ err = platform_device_add(acer_platform_device);
+ if (err)
+ goto error_device_add;
err = create_sysfs();
if (err)
- return err;
+ goto error_create_sys;
if (wmi_has_guid(WMID_GUID2)) {
interface->debug.wmid_devices = get_wmid_devices();
err = create_debugfs();
if (err)
- return err;
+ goto error_create_debugfs;
}
/* Override any initial settings with values from the commandline */
@@ -1350,8 +1359,16 @@ static int __init acer_wmi_init(void)
return 0;
+error_create_debugfs:
+ remove_sysfs(acer_platform_device);
+error_create_sys:
+ platform_device_del(acer_platform_device);
+error_device_add:
+ platform_device_put(acer_platform_device);
+error_device_alloc:
+ platform_driver_unregister(&acer_platform_driver);
error_platform_register:
- return -ENODEV;
+ return err;
}
static void __exit acer_wmi_exit(void)