From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: Zhao Yakui <yakui.zhao@intel.com>,
linux-acpi@vger.kernel.org, Alex Chiang <achiang@hp.com>,
Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Subject: [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits
Date: Mon, 22 Jun 2009 14:41:09 -0600 [thread overview]
Message-ID: <20090622204109.32761.20391.stgit@bob.kio> (raw)
In-Reply-To: <20090622204016.32761.47464.stgit@bob.kio>
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>
---
drivers/acpi/processor_core.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index d8e210a..7f082b6 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -722,11 +722,13 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
result = acpi_processor_add_fs(device);
if (result)
- goto end;
+ return result;
sysdev = get_cpu_sysdev(pr->id);
- if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
- return -EFAULT;
+ if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) {
+ result = -EFAULT;
+ goto err_remove_fs;
+ }
/* _PDC call should be done before doing anything else (if reqd.). */
arch_acpi_processor_init_pdc(pr);
@@ -746,7 +748,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
&processor_cooling_ops);
if (IS_ERR(pr->cdev)) {
result = PTR_ERR(pr->cdev);
- goto end;
+ goto err_power_exit;
}
dev_info(&device->dev, "registered as cooling_device%d\n",
@@ -755,13 +757,17 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
result = sysfs_create_link(&device->dev.kobj,
&pr->cdev->device.kobj,
"thermal_cooling");
- if (result)
+ if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
+ goto err_thermal_unregister;
+ }
result = sysfs_create_link(&pr->cdev->device.kobj,
&device->dev.kobj,
"device");
- if (result)
+ if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
+ goto err_remove_sysfs;
+ }
if (pr->flags.throttling) {
printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -770,7 +776,16 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
printk(")\n");
}
- end:
+ return 0;
+
+err_remove_sysfs:
+ sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+err_thermal_unregister:
+ thermal_cooling_device_unregister(pr->cdev);
+err_power_exit:
+ acpi_processor_power_exit(pr, device);
+err_remove_fs:
+ acpi_processor_remove_fs(device);
return result;
}
next prev parent reply other threads:[~2009-06-22 20:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 1/9] ACPI: processor: remove KOBJ_ONLINE/KOBJ_OFFLINE events Bjorn Helgaas
2009-06-22 20:41 ` Bjorn Helgaas [this message]
2009-06-22 20:41 ` [PATCH 3/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add() Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 4/9] ACPI: processor: remove .start() method Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 5/9] ACPI: memory hotplug: " Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add() Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 7/9] ACPI: EC: remove .start() method Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 8/9] ACPI: EC: remove .stop() method Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method Bjorn Helgaas
2009-06-24 1:23 ` [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Len Brown
2009-06-25 2:09 ` Yasunori Goto
2009-06-29 20:32 ` Bjorn Helgaas
-- strict thread matches above, loose matches on Subject: below --
2009-06-19 21:31 [PATCH 0/9] " Bjorn Helgaas
2009-06-19 21:31 ` [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090622204109.32761.20391.stgit@bob.kio \
--to=bjorn.helgaas@hp.com \
--cc=achiang@hp.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=venkatesh.pallipadi@intel.com \
--cc=yakui.zhao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox