linux/debian/patches/features/all/cpu-devices/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: 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>
---
drivers/base/base.h | 2 +-
drivers/base/cpu.c | 13 +++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -94,7 +94,7 @@
static inline int hypervisor_init(void) { return 0; }
#endif
extern int platform_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 @@
* CPU subsystem support
*/
+#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
@@ -267,16 +268,12 @@
NULL,
};
-int __init cpu_dev_init(void)
+void __init cpu_dev_init(void)
{
- int err;
-
- err = subsys_system_register(&cpu_subsys, cpu_root_attr_groups);
- if (err)
- return err;
+ if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups))
+ panic("Failed to register CPU subsystem");
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
- err = sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root);
+ sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root);
#endif
- return err;
}