diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-06-22 04:17:38 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2010-08-03 09:48:48 -0400 |
commit | 1c79632bd011de84f32dcdf7d92b65bb61b1e6da (patch) | |
tree | 1979524674de695dbe9b1f083c6261dd95a0bc8e | |
parent | e9ec7f3539cbeae8ffc5d7b30543e5612df5cba3 (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>
-rw-r--r-- | drivers/platform/x86/acer-wmi.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 1ea6c434d330..ae79624a692e 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) | |||
1327 | "generic video driver\n"); | 1327 | "generic video driver\n"); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | if (platform_driver_register(&acer_platform_driver)) { | 1330 | err = platform_driver_register(&acer_platform_driver); |
1331 | if (err) { | ||
1331 | printk(ACER_ERR "Unable to register platform driver.\n"); | 1332 | printk(ACER_ERR "Unable to register platform driver.\n"); |
1332 | goto error_platform_register; | 1333 | goto error_platform_register; |
1333 | } | 1334 | } |
1335 | |||
1334 | acer_platform_device = platform_device_alloc("acer-wmi", -1); | 1336 | acer_platform_device = platform_device_alloc("acer-wmi", -1); |
1335 | platform_device_add(acer_platform_device); | 1337 | if (!acer_platform_device) { |
1338 | err = -ENOMEM; | ||
1339 | goto error_device_alloc; | ||
1340 | } | ||
1341 | |||
1342 | err = platform_device_add(acer_platform_device); | ||
1343 | if (err) | ||
1344 | goto error_device_add; | ||
1336 | 1345 | ||
1337 | err = create_sysfs(); | 1346 | err = create_sysfs(); |
1338 | if (err) | 1347 | if (err) |
1339 | return err; | 1348 | goto error_create_sys; |
1340 | 1349 | ||
1341 | if (wmi_has_guid(WMID_GUID2)) { | 1350 | if (wmi_has_guid(WMID_GUID2)) { |
1342 | interface->debug.wmid_devices = get_wmid_devices(); | 1351 | interface->debug.wmid_devices = get_wmid_devices(); |
1343 | err = create_debugfs(); | 1352 | err = create_debugfs(); |
1344 | if (err) | 1353 | if (err) |
1345 | return err; | 1354 | goto error_create_debugfs; |
1346 | } | 1355 | } |
1347 | 1356 | ||
1348 | /* Override any initial settings with values from the commandline */ | 1357 | /* Override any initial settings with values from the commandline */ |
@@ -1350,8 +1359,16 @@ static int __init acer_wmi_init(void) | |||
1350 | 1359 | ||
1351 | return 0; | 1360 | return 0; |
1352 | 1361 | ||
1362 | error_create_debugfs: | ||
1363 | remove_sysfs(acer_platform_device); | ||
1364 | error_create_sys: | ||
1365 | platform_device_del(acer_platform_device); | ||
1366 | error_device_add: | ||
1367 | platform_device_put(acer_platform_device); | ||
1368 | error_device_alloc: | ||
1369 | platform_driver_unregister(&acer_platform_driver); | ||
1353 | error_platform_register: | 1370 | error_platform_register: |
1354 | return -ENODEV; | 1371 | return err; |
1355 | } | 1372 | } |
1356 | 1373 | ||
1357 | static void __exit acer_wmi_exit(void) | 1374 | static void __exit acer_wmi_exit(void) |