From: Glauber Costa <gcosta@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, andrew.grover@intel.com,
paul.s.diefenbaugh@intel.com, linux@brodo.de,
anil.s.keshavamurthy@intel.com, lenb@kernel.org,
linux-acpi@vger.kernel.org, Glauber Costa <gcosta@redhat.com>
Subject: [PATCH 3/4] provide error handling for unclean objects
Date: Mon, 18 Feb 2008 17:56:52 -0300 [thread overview]
Message-ID: <1203368213-30528-3-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <1203368213-30528-2-git-send-email-gcosta@redhat.com>
Previously, if acpi_processor_start() failed to
create sysfs nodes, it would leave stuff to be cleaned,
that won't perish in acpi_processor_remove(),
since we'll have pr->cdev == NULL.
This patch cleans those objects.
Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
drivers/acpi/processor_core.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 5023410..06a230a 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -680,11 +680,12 @@ #endif
result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj,
"thermal_cooling");
if (result)
- return result;
+ goto err_thermal;
+
result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj,
"device");
if (result)
- return result;
+ goto err_sysfs;
pr->cdev = cdev;
@@ -694,9 +695,13 @@ #endif
printk(" %d throttling states", pr->throttling.state_count);
printk(")\n");
}
+ return result;
- end:
-
+err_sysfs:
+ sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+err_thermal:
+ thermal_cooling_device_unregister(pr->cdev);
+end:
return result;
}
--
1.4.2
next prev parent reply other threads:[~2008-02-18 21:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-18 20:56 [PATCH 1/4] make cdev attribuition the last step Glauber Costa
2008-02-18 20:56 ` [PATCH 2/4] use pr->cdev as a condition for cleanup Glauber Costa
2008-02-18 20:56 ` Glauber Costa [this message]
2008-02-18 20:56 ` [PATCH 4/4] remove goto statement Glauber Costa
2008-02-19 1:19 ` Li Zefan
2008-02-19 2:07 ` Glauber Costa
2008-02-19 2:22 ` Li Zefan
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=1203368213-30528-3-git-send-email-gcosta@redhat.com \
--to=gcosta@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andrew.grover@intel.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@brodo.de \
--cc=paul.s.diefenbaugh@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
all inboxes | Powered by JetHome®