diff options
author | Durgadoss R <durgadoss.r@intel.com> | 2011-03-02 23:00:13 (GMT) |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-03-23 05:43:44 (GMT) |
commit | b299eb5cde1a91706c450804006c6559b0826df8 (patch) | |
tree | e0007358f68edad3d435ce81ed2e4ce30c74cff1 /drivers/thermal/thermal_sys.c | |
parent | 521cb40b0c44418a4fd36dc633f575813d59a43d (diff) | |
download | linux-b299eb5cde1a91706c450804006c6559b0826df8.tar.xz |
ACPI:Fix goto flows in thermal-sys
This patch fixes two minor bugs in thermal_sys:
(a) The flow of goto's in thermal_hwmon_add_sysfs.
(b) Remove the temp*_crit only if there is a get_crit_temp defined, in
thermal_remove_hwmon_sysfs.
Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/thermal/thermal_sys.c')
-rw-r--r-- | drivers/thermal/thermal_sys.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 713b7ea..0b1c82a 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -499,7 +499,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) dev_set_drvdata(hwmon->device, hwmon); result = device_create_file(hwmon->device, &dev_attr_name); if (result) - goto unregister_hwmon_device; + goto free_mem; register_sys_interface: tz->hwmon = hwmon; @@ -513,7 +513,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) sysfs_attr_init(&tz->temp_input.attr.attr); result = device_create_file(hwmon->device, &tz->temp_input.attr); if (result) - goto unregister_hwmon_device; + goto unregister_name; if (tz->ops->get_crit_temp) { unsigned long temperature; @@ -527,7 +527,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) result = device_create_file(hwmon->device, &tz->temp_crit.attr); if (result) - goto unregister_hwmon_device; + goto unregister_input; } } @@ -539,9 +539,9 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) return 0; - unregister_hwmon_device: - device_remove_file(hwmon->device, &tz->temp_crit.attr); + unregister_input: device_remove_file(hwmon->device, &tz->temp_input.attr); + unregister_name: if (new_hwmon_device) { device_remove_file(hwmon->device, &dev_attr_name); hwmon_device_unregister(hwmon->device); @@ -560,7 +560,8 @@ thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) tz->hwmon = NULL; device_remove_file(hwmon->device, &tz->temp_input.attr); - device_remove_file(hwmon->device, &tz->temp_crit.attr); + if (tz->ops->get_crit_temp) + device_remove_file(hwmon->device, &tz->temp_crit.attr); mutex_lock(&thermal_list_lock); list_del(&tz->hwmon_node); |