Re: [RFC PATCH v2 05/35] drivers: base: Print a warning instead of panic() when register_cpu() fails

From: Russell King (Oracle)
Date: Thu Sep 14 2023 - 05:53:10 EST


On Wed, Sep 13, 2023 at 04:37:53PM +0000, James Morse wrote:
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
>
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
>
> Downgrade this to a warning to make it easier to debug this issue.
>
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
>
> Signed-off-by: James Morse <james.morse@xxxxxxx>

Assuming other architectures do similar to x86 (which only return the
error code from register_cpu()), the only error that would occur here
is if device_register() fails, which would be catastophic, and I
suspect the system would fail to boot anyway.

Downgrading the panic to a warning at least gives us a chance that
the system may come up sufficiently to examine what happened, so I
think this makes sense:

Reviewed-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!