diff options
Diffstat (limited to 'drivers/thermal')
-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 713b7ea4a607..0b1c82ad6805 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) | |||
499 | dev_set_drvdata(hwmon->device, hwmon); | 499 | dev_set_drvdata(hwmon->device, hwmon); |
500 | result = device_create_file(hwmon->device, &dev_attr_name); | 500 | result = device_create_file(hwmon->device, &dev_attr_name); |
501 | if (result) | 501 | if (result) |
502 | goto unregister_hwmon_device; | 502 | goto free_mem; |
503 | 503 | ||
504 | register_sys_interface: | 504 | register_sys_interface: |
505 | tz->hwmon = hwmon; | 505 | tz->hwmon = hwmon; |
@@ -513,7 +513,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | |||
513 | sysfs_attr_init(&tz->temp_input.attr.attr); | 513 | sysfs_attr_init(&tz->temp_input.attr.attr); |
514 | result = device_create_file(hwmon->device, &tz->temp_input.attr); | 514 | result = device_create_file(hwmon->device, &tz->temp_input.attr); |
515 | if (result) | 515 | if (result) |
516 | goto unregister_hwmon_device; | 516 | goto unregister_name; |
517 | 517 | ||
518 | if (tz->ops->get_crit_temp) { | 518 | if (tz->ops->get_crit_temp) { |
519 | unsigned long temperature; | 519 | unsigned long temperature; |
@@ -527,7 +527,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | |||
527 | result = device_create_file(hwmon->device, | 527 | result = device_create_file(hwmon->device, |
528 | &tz->temp_crit.attr); | 528 | &tz->temp_crit.attr); |
529 | if (result) | 529 | if (result) |
530 | goto unregister_hwmon_device; | 530 | goto unregister_input; |
531 | } | 531 | } |
532 | } | 532 | } |
533 | 533 | ||
@@ -539,9 +539,9 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | |||
539 | 539 | ||
540 | return 0; | 540 | return 0; |
541 | 541 | ||
542 | unregister_hwmon_device: | 542 | unregister_input: |
543 | device_remove_file(hwmon->device, &tz->temp_crit.attr); | ||
544 | device_remove_file(hwmon->device, &tz->temp_input.attr); | 543 | device_remove_file(hwmon->device, &tz->temp_input.attr); |
544 | unregister_name: | ||
545 | if (new_hwmon_device) { | 545 | if (new_hwmon_device) { |
546 | device_remove_file(hwmon->device, &dev_attr_name); | 546 | device_remove_file(hwmon->device, &dev_attr_name); |
547 | hwmon_device_unregister(hwmon->device); | 547 | hwmon_device_unregister(hwmon->device); |
@@ -560,7 +560,8 @@ thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) | |||
560 | 560 | ||
561 | tz->hwmon = NULL; | 561 | tz->hwmon = NULL; |
562 | device_remove_file(hwmon->device, &tz->temp_input.attr); | 562 | device_remove_file(hwmon->device, &tz->temp_input.attr); |
563 | device_remove_file(hwmon->device, &tz->temp_crit.attr); | 563 | if (tz->ops->get_crit_temp) |
564 | device_remove_file(hwmon->device, &tz->temp_crit.attr); | ||
564 | 565 | ||
565 | mutex_lock(&thermal_list_lock); | 566 | mutex_lock(&thermal_list_lock); |
566 | list_del(&tz->hwmon_node); | 567 | list_del(&tz->hwmon_node); |