aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorXiang W <wxjstz@126.com>2023-05-22 13:18:06 +0800
committerAnup Patel <anup@brainfault.org>2023-05-26 12:36:54 +0530
commit8b99a7f7d8294be29e18a667d51e13755ed2c0e0 (patch)
treea390cbb188c533ad5d6485772889b17b1e8c7b26 /lib
parentd4c46e0ff1b0ead9d5a586e1a19a00a92160206d (diff)
downloadopensbi-8b99a7f7d8294be29e18a667d51e13755ed2c0e0.zip
opensbi-8b99a7f7d8294be29e18a667d51e13755ed2c0e0.tar.gz
opensbi-8b99a7f7d8294be29e18a667d51e13755ed2c0e0.tar.bz2
lib: sbi: Fix return of sbi_console_init
console is not a required peripheral. So it should return success when the console does not exist. Signed-off-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/sbi/sbi_console.c8
1 files changed, 7 insertions, 1 deletions
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;
}