From bdeeed098811b36d1f988521600a89a400830a4b Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 9 May 2018 11:04:48 +1000 Subject: nubus: Call bus_register unconditionally Loading a NuBus driver module on a non-NuBus machine triggers the BUG_ON(!drv->bus->p) in driver_register(), because bus_register() was not called, because it is conditional on MACH_IS_MAC. Fix the crash by calling bus_register() unconditionally. Call it from a postcore_initcall(), like other busses do. Hence, the bus type is available for device_register(), which happens in a subsys initcall, and for driver_register(), which happens in a device or module initcall. Cc: Greg Kroah-Hartman Reported-by: Michael Schmitz Tested-by: Stan Johnson Fixes: 7f86c765a6a2 ("nubus: Add support for the driver model") Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/nubus/nubus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/nubus/nubus.c') diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index 4621ff98138c..bb0d63a44f41 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c @@ -875,7 +875,7 @@ static int __init nubus_init(void) return 0; nubus_proc_init(); - err = nubus_bus_register(); + err = nubus_parent_device_register(); if (err) return err; nubus_scan_bus(); -- cgit v1.2.3