From: Hanjun Guo <guohanjun@huawei.com>
To: <kernel.openeuler@huawei.com>
Cc: Toshi Kani <toshi.kani@hp.com>, Jiang Liu <jiang.liu@huawei.com>,
<linux-ia64@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/4] cpuidle: fix error handling in __cpuidle_register_device
Date: Wed, 10 Apr 2013 18:22:58 +0800 [thread overview]
Message-ID: <1365589381-5624-2-git-send-email-guohanjun@huawei.com> (raw)
In-Reply-To: <1365589381-5624-1-git-send-email-guohanjun@huawei.com>
From: Colin Cross <ccross@android.com>
mainline inclusion
from mainline-3.6
upstream commit 3af272ab75c7a0c7fa5ae5507724d961f7e7718b
category: bugfix
--------------------------------------------------------
Fix the error handling in __cpuidle_register_device to include
the missing list_del. Move it to a label, which will simplify
the error handling when coupled states are added.
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Colin Cross <ccross@android.com>
Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
Integrated-by: Hanjun Guo <guohanjun@huawei.com>
---
drivers/cpuidle/cpuidle.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 2f0083a..7407a98 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -387,13 +387,18 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
per_cpu(cpuidle_devices, dev->cpu) = dev;
list_add(&dev->device_list, &cpuidle_detected_devices);
- if ((ret = cpuidle_add_sysfs(cpu_dev))) {
- module_put(cpuidle_driver->owner);
- return ret;
- }
+ ret = cpuidle_add_sysfs(cpu_dev);
+ if (ret)
+ goto err_sysfs;
dev->registered = 1;
return 0;
+
+err_sysfs:
+ list_del(&dev->device_list);
+ per_cpu(cpuidle_devices, dev->cpu) = NULL;
+ module_put(cpuidle_driver->owner);
+ return ret;
}
/**
--
1.6.0.2
next prev parent reply other threads:[~2013-04-10 10:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 10:22 [PATCH 0/4] ACPI and PM patches for Euler stable from mainline v3.6 Hanjun Guo
2013-04-10 10:22 ` Hanjun Guo [this message]
2013-04-10 10:22 ` [PATCH 2/4] cpufreq: Fix sysfs deadlock with concurrent hotplug/frequency switch Hanjun Guo
2013-04-10 10:23 ` [PATCH 3/4] ACPI: Untangle a return statement for better readability Hanjun Guo
2013-04-10 10:23 ` [PATCH 4/4] ACPI: Only count valid srat memory structures Hanjun Guo
2013-04-10 10:33 ` [PATCH 0/4] ACPI and PM patches for Euler stable from mainline v3.6 Hanjun Guo
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=1365589381-5624-2-git-send-email-guohanjun@huawei.com \
--to=guohanjun@huawei.com \
--cc=jiang.liu@huawei.com \
--cc=kernel.openeuler@huawei.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=toshi.kani@hp.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