[PATCH 1/4] lib: sbi: Fix the hang condition of console init

Anup Patel anup at brainfault.org
Sun May 21 20:37:00 PDT 2023


On Tue, May 9, 2023 at 8:17 PM Xiang W <wxjstz at 126.com> wrote:
>
> console is not a required device and should not hang when
> sbi_console_init returns SBI_ENODEV
>
> Signed-off-by: Xiang W <wxjstz at 126.com>
> ---
>  lib/sbi/sbi_init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
> index 5db8e7f..ec0bcb0 100644
> --- a/lib/sbi/sbi_init.c
> +++ b/lib/sbi/sbi_init.c
> @@ -286,7 +286,7 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
>                 sbi_hart_hang();
>
>         rc = sbi_console_init(scratch);
> -       if (rc)
> +       if (rc && rc != SBI_ENODEV)

Move this special error check in sbi_console_init() such that
sbi_console_init() returns 0 when sbi_platform_console_init()
returns SBI_ENODEV.

>                 sbi_hart_hang();
>
>         rc = sbi_pmu_init(scratch, true);
> --
> 2.39.2
>

Regards,
Anup



More information about the opensbi mailing list