aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_core.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-06-22 16:41:09 -0400
committerLen Brown <len.brown@intel.com>2009-06-25 12:16:32 -0400
commitd4e0526184199e23ac1460fe59b8a3741b17a8b5 (patch)
treef70ff63eabb59d4b5f8280267c998e4b8bfca358 /drivers/acpi/processor_core.c
parentc1815e074079838d36d89e45e92b7ee317190700 (diff)
ACPI: processor: clean up in acpi_processor_start() error exits
We used to leave crud around if things failed in acpi_processor_start(). This patch cleans up as much as we can before returning. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Reviewed-by: Alex Chiang <achiang@hp.com> CC: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> CC: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/processor_core.c')
-rw-r--r--drivers/acpi/processor_core.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index c6ec68d4f16..a496a863ede 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -731,11 +731,13 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
731 731
732 result = acpi_processor_add_fs(device); 732 result = acpi_processor_add_fs(device);
733 if (result) 733 if (result)
734 goto end; 734 return result;
735 735
736 sysdev = get_cpu_sysdev(pr->id); 736 sysdev = get_cpu_sysdev(pr->id);
737 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) 737 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) {
738 return -EFAULT; 738 result = -EFAULT;
739 goto err_remove_fs;
740 }
739 741
740 /* _PDC call should be done before doing anything else (if reqd.). */ 742 /* _PDC call should be done before doing anything else (if reqd.). */
741 arch_acpi_processor_init_pdc(pr); 743 arch_acpi_processor_init_pdc(pr);
@@ -755,7 +757,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
755 &processor_cooling_ops); 757 &processor_cooling_ops);
756 if (IS_ERR(pr->cdev)) { 758 if (IS_ERR(pr->cdev)) {
757 result = PTR_ERR(pr->cdev); 759 result = PTR_ERR(pr->cdev);
758 goto end; 760 goto err_power_exit;
759 } 761 }
760 762
761 dev_info(&device->dev, "registered as cooling_device%d\n", 763 dev_info(&device->dev, "registered as cooling_device%d\n",
@@ -764,13 +766,17 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
764 result = sysfs_create_link(&device->dev.kobj, 766 result = sysfs_create_link(&device->dev.kobj,
765 &pr->cdev->device.kobj, 767 &pr->cdev->device.kobj,
766 "thermal_cooling"); 768 "thermal_cooling");
767 if (result) 769 if (result) {
768 printk(KERN_ERR PREFIX "Create sysfs link\n"); 770 printk(KERN_ERR PREFIX "Create sysfs link\n");
771 goto err_thermal_unregister;
772 }
769 result = sysfs_create_link(&pr->cdev->device.kobj, 773 result = sysfs_create_link(&pr->cdev->device.kobj,
770 &device->dev.kobj, 774 &device->dev.kobj,
771 "device"); 775 "device");
772 if (result) 776 if (result) {
773 printk(KERN_ERR PREFIX "Create sysfs link\n"); 777 printk(KERN_ERR PREFIX "Create sysfs link\n");
778 goto err_remove_sysfs;
779 }
774 780
775 if (pr->flags.throttling) { 781 if (pr->flags.throttling) {
776 printk(KERN_INFO PREFIX "%s [%s] (supports", 782 printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -779,7 +785,16 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
779 printk(")\n"); 785 printk(")\n");
780 } 786 }
781 787
782 end: 788 return 0;
789
790err_remove_sysfs:
791 sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
792err_thermal_unregister:
793 thermal_cooling_device_unregister(pr->cdev);
794err_power_exit:
795 acpi_processor_power_exit(pr, device);
796err_remove_fs:
797 acpi_processor_remove_fs(device);
783 798
784 return result; 799 return result;
785} 800}