Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1372829
| From | Len Brown <lenb@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 06/13] intel_idle: Fix dangling registration on error path. |
| Date | 2016-04-06 23:10 +0200 |
| Message-ID | <rl2S7-1tt-35@gated-at.bofh.it> (permalink) |
| References | <rl2S6-1tt-7@gated-at.bofh.it> |
| Organization | Intel Open Source Technology Center |
From: Richard Cochran <rcochran@linutronix.de>
In the module_init() method, if the per-CPU allocation fails, then the
active cpuidle registration is not cleaned up. This patch fixes the
issue by attempting the allocation before registration, and then
cleaning it up again on registration failure.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Signed-off-by: Len Brown <len.brown@intel.com>
---
drivers/idle/intel_idle.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 5b309e5..085538a 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1347,19 +1347,20 @@ static int __init intel_idle_init(void)
if (retval)
return retval;
+ intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);
+ if (intel_idle_cpuidle_devices == NULL)
+ return -ENOMEM;
+
intel_idle_cpuidle_driver_init();
retval = cpuidle_register_driver(&intel_idle_driver);
if (retval) {
struct cpuidle_driver *drv = cpuidle_get_driver();
printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
drv ? drv->name : "none");
+ free_percpu(intel_idle_cpuidle_devices);
return retval;
}
- intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);
- if (intel_idle_cpuidle_devices == NULL)
- return -ENOMEM;
-
cpu_notifier_register_begin();
for_each_online_cpu(i) {
--
2.8.0.rc4.16.g56331f8
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/13] intel_idle patches ready for upstream Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 13/13] intel_idle: Add KBL support Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 08/13] intel_idle: Setup the timer broadcast only on successful driver load. Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 07/13] intel_idle: Avoid a double free of the per-CPU data. Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 02/13] intel_idle: remove useless return from void function. Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 04/13] intel_idle: Remove redundant initialization calls. Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 06/13] intel_idle: Fix dangling registration on error path. Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 01/13] intel_idle: add BXT support Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200 [PATCH 09/13] intel_idle: Don't overreact to a cpuidle registration failure. Len Brown <lenb@kernel.org> - 2016-04-06 23:10 +0200
csiph-web