linux/debian/patches/bugfix/all/cpu-Do-not-return-errors-fr...

64 lines
1.8 KiB
Diff

From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 10 Jan 2012 02:59:49 +0000
Subject: [PATCH 1/2] cpu: Do not return errors from cpu_dev_init() which will
be ignored
commit 024f78462c3da710642a54939888a92e28704653 upstream.
cpu_dev_init() is only called from driver_init(), which does not check
its return value. Therefore make cpu_dev_init() return void.
We must register the CPU subsystem, so panic if this fails.
If sched_create_sysfs_power_savings_entries() fails, the damage is
contained, so ignore this (as before).
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backport to 3.2]
---
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -95,7 +95,7 @@ extern int hypervisor_init(void);
#endif
extern int platform_bus_init(void);
extern int system_bus_init(void);
-extern int cpu_dev_init(void);
+extern void cpu_dev_init(void);
extern int bus_add_device(struct device *dev);
extern void bus_probe_device(struct device *dev);
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -2,6 +2,7 @@
* drivers/base/cpu.c - basic CPU class support
*/
+#include <linux/kernel.h>
#include <linux/sysdev.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -247,17 +248,14 @@ bool cpu_is_hotpluggable(unsigned cpu)
}
EXPORT_SYMBOL_GPL(get_cpu_sysdev);
-int __init cpu_dev_init(void)
+void __init cpu_dev_init(void)
{
- int err;
-
- err = sysdev_class_register(&cpu_sysdev_class);
+ if (sysdev_class_register(&cpu_sysdev_class))
+ panic("Failed to register CPU subsystem");
+
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
- if (!err)
- err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class);
+ sched_create_sysfs_power_savings_entries(&cpu_sysdev_class);
#endif
-
- return err;
}
static struct sysdev_class_attribute *cpu_sysdev_class_attrs[] = {