Skip to content

Commit 024f784

Browse files
bwhackstorvalds
authored andcommitted
cpu: Do not return errors from cpu_dev_init() which will be ignored
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>
1 parent 4f58cb9 commit 024f784

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎drivers/base/base.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ extern int hypervisor_init(void);
9494
static inline int hypervisor_init(void) { return 0; }
9595
#endif
9696
extern int platform_bus_init(void);
97-
extern int cpu_dev_init(void);
97+
extern void cpu_dev_init(void);
9898

9999
extern int bus_add_device(struct device *dev);
100100
extern void bus_probe_device(struct device *dev);

‎drivers/base/cpu.c‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* CPU subsystem support
33
*/
44

5+
#include <linux/kernel.h>
56
#include <linux/module.h>
67
#include <linux/init.h>
78
#include <linux/sched.h>
@@ -274,16 +275,12 @@ bool cpu_is_hotpluggable(unsigned cpu)
274275
}
275276
EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
276277

277-
int __init cpu_dev_init(void)
278+
void __init cpu_dev_init(void)
278279
{
279-
int err;
280-
281-
err = subsys_system_register(&cpu_subsys, cpu_root_attr_groups);
282-
if (err)
283-
return err;
280+
if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups))
281+
panic("Failed to register CPU subsystem");
284282

285283
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
286-
err = sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root);
284+
sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root);
287285
#endif
288-
return err;
289286
}

0 commit comments

Comments
 (0)