[PATCH v3 1/4] lib: sbi: Fix return of sbi_console_init

Anup Patel anup at brainfault.org
Tue May 23 23:02:34 PDT 2023


On Mon, May 22, 2023 at 10:49 AM Xiang W <wxjstz at 126.com> wrote:
>
> console is not a required peripheral. So it should return success when
> the console does not exist.
>
> Signed-off-by: Xiang W <wxjstz at 126.com>

Looks good to me.

Reviewed-by: Anup Patel <anup at brainfault.org>

Regards,
Anup

> ---
>  lib/sbi/sbi_console.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/sbi/sbi_console.c b/lib/sbi/sbi_console.c
> index f3ac003..168dffd 100644
> --- a/lib/sbi/sbi_console.c
> +++ b/lib/sbi/sbi_console.c
> @@ -481,5 +481,11 @@ void sbi_console_set_device(const struct sbi_console_device *dev)
>
>  int sbi_console_init(struct sbi_scratch *scratch)
>  {
> -       return sbi_platform_console_init(sbi_platform_ptr(scratch));
> +       int rc = sbi_platform_console_init(sbi_platform_ptr(scratch));
> +
> +       /* console is not a necessary device */
> +       if (rc == SBI_ENODEV)
> +               return 0;
> +
> +       return rc;
>  }
> --
> 2.39.2
>



More information about the opensbi mailing list