Re: [PATCH] firmware: coreboot: Register bus in module init

From: Stephen Boyd
Date: Thu Oct 20 2022 - 20:04:34 EST


Quoting Brian Norris (2022-10-19 18:10:53)
[...]
> [ 0.114560] do_initcall_level+0x134/0x160
> [ 0.114571] do_initcalls+0x60/0xa0
> [ 0.114579] do_basic_setup+0x28/0x34
> [ 0.114588] kernel_init_freeable+0xf8/0x150
> [ 0.114596] kernel_init+0x2c/0x12c
> [ 0.114607] ret_from_fork+0x10/0x20
> [ 0.114624] Code: 5280002b 1100054a b900092a f9800011 (885ffc01)
> [ 0.114631] ---[ end trace 0000000000000000 ]---
>
> Fixes: b81e3140e412 ("firmware: coreboot: Make bus registration symmetric")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
> ---

Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>

> diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
> index c52bcaa9def6..9ca21feb9d45 100644
> --- a/drivers/firmware/google/coreboot_table.c
> +++ b/drivers/firmware/google/coreboot_table.c
> @@ -199,6 +194,32 @@ static struct platform_driver coreboot_table_driver = {
> .of_match_table = of_match_ptr(coreboot_of_match),
> },
> };
> -module_platform_driver(coreboot_table_driver);
> +
> +static int __init coreboot_table_driver_init(void)
> +{
> + int ret;
> +
> + ret = bus_register(&coreboot_bus_type);
> + if (ret)
> + return ret;
> +
> + ret = platform_driver_register(&coreboot_table_driver);
> + if (ret) {
> + bus_unregister(&coreboot_bus_type);
> + return ret;
> + }
> +
> + return 0;

This could be 'return ret' and two lines could be saved, but that is
super nitpick so whatever.