Commit b299eb5c authored by Durgadoss R's avatar Durgadoss R Committed by Len Brown

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: default avatarDurgadoss R <durgadoss.r@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 521cb40b
...@@ -499,7 +499,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) ...@@ -499,7 +499,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
dev_set_drvdata(hwmon->device, hwmon); dev_set_drvdata(hwmon->device, hwmon);
result = device_create_file(hwmon->device, &dev_attr_name); result = device_create_file(hwmon->device, &dev_attr_name);
if (result) if (result)
goto unregister_hwmon_device; goto free_mem;
register_sys_interface: register_sys_interface:
tz->hwmon = hwmon; tz->hwmon = hwmon;
...@@ -513,7 +513,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) ...@@ -513,7 +513,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
sysfs_attr_init(&tz->temp_input.attr.attr); sysfs_attr_init(&tz->temp_input.attr.attr);
result = device_create_file(hwmon->device, &tz->temp_input.attr); result = device_create_file(hwmon->device, &tz->temp_input.attr);
if (result) if (result)
goto unregister_hwmon_device; goto unregister_name;
if (tz->ops->get_crit_temp) { if (tz->ops->get_crit_temp) {
unsigned long temperature; unsigned long temperature;
...@@ -527,7 +527,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) ...@@ -527,7 +527,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
result = device_create_file(hwmon->device, result = device_create_file(hwmon->device,
&tz->temp_crit.attr); &tz->temp_crit.attr);
if (result) if (result)
goto unregister_hwmon_device; goto unregister_input;
} }
} }
...@@ -539,9 +539,9 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) ...@@ -539,9 +539,9 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
return 0; return 0;
unregister_hwmon_device: unregister_input:
device_remove_file(hwmon->device, &tz->temp_crit.attr);
device_remove_file(hwmon->device, &tz->temp_input.attr); device_remove_file(hwmon->device, &tz->temp_input.attr);
unregister_name:
if (new_hwmon_device) { if (new_hwmon_device) {
device_remove_file(hwmon->device, &dev_attr_name); device_remove_file(hwmon->device, &dev_attr_name);
hwmon_device_unregister(hwmon->device); hwmon_device_unregister(hwmon->device);
...@@ -560,6 +560,7 @@ thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) ...@@ -560,6 +560,7 @@ thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
tz->hwmon = NULL; tz->hwmon = NULL;
device_remove_file(hwmon->device, &tz->temp_input.attr); device_remove_file(hwmon->device, &tz->temp_input.attr);
if (tz->ops->get_crit_temp)
device_remove_file(hwmon->device, &tz->temp_crit.attr); device_remove_file(hwmon->device, &tz->temp_crit.attr);
mutex_lock(&thermal_list_lock); mutex_lock(&thermal_list_lock);
......
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