Re: [PATCH v2] nubus: Call bus_register unconditionally

From: Geert Uytterhoeven
Date: Wed May 09 2018 - 03:31:45 EST


On Wed, May 9, 2018 at 3:04 AM, Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx> wrote:
> 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 <gregkh@xxxxxxxxxxxxxxxxxxx>
> Reported-by: Michael Schmitz <schmitzmic@xxxxxxxxx>
> Tested-by: Stan Johnson <userm57@xxxxxxxxx>
> Fixes: 7f86c765a6a2 ("nubus: Add support for the driver model")
> Signed-off-by: Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds