Commit 6996abf0 authored by Nicolas Boichat's avatar Nicolas Boichat Committed by Jean Delvare

hwmon/applesmc: Handle name file creation error and deletion

The previous patch was incomplete.
Signed-off-by: default avatarNicolas Boichat <nicolas@boichat.ch>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 548c343b
...@@ -1206,11 +1206,13 @@ static int __init applesmc_init(void) ...@@ -1206,11 +1206,13 @@ static int __init applesmc_init(void)
} }
ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr);
if (ret)
goto out_device;
/* Create key enumeration sysfs files */ /* Create key enumeration sysfs files */
ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group);
if (ret) if (ret)
goto out_device; goto out_name;
/* create fan files */ /* create fan files */
count = applesmc_get_fan_count(); count = applesmc_get_fan_count();
...@@ -1310,6 +1312,8 @@ static int __init applesmc_init(void) ...@@ -1310,6 +1312,8 @@ static int __init applesmc_init(void)
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
out_key_enumeration: out_key_enumeration:
sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
out_name:
sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
out_device: out_device:
platform_device_unregister(pdev); platform_device_unregister(pdev);
out_driver: out_driver:
...@@ -1335,6 +1339,7 @@ static void __exit applesmc_exit(void) ...@@ -1335,6 +1339,7 @@ static void __exit applesmc_exit(void)
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]);
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
platform_device_unregister(pdev); platform_device_unregister(pdev);
platform_driver_unregister(&applesmc_driver); platform_driver_unregister(&applesmc_driver);
release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment