[PATCH 2/3] cmd/sbi: error message for failure to get spec version
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Sat Oct 1 09:39:39 CEST 2022
If calling 'Get SBI specification version' fails, write an error message
and return CMD_RET_FAILURE.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
cmd/riscv/sbi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 160d7c7b30..70574bbc66 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -56,8 +56,11 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
long mvendorid, marchid, mimpid;
ret = sbi_get_spec_version();
- if (ret >= 0)
- printf("SBI %ld.%ld", ret >> 24, ret & 0xffffff);
+ if (ret < 0) {
+ printf("No SBI 0.2+\n");
+ return CMD_RET_FAILURE;
+ }
+ printf("SBI %ld.%ld", ret >> 24, ret & 0xffffff);
impl_id = sbi_get_impl_id();
if (impl_id >= 0) {
for (i = 0; i < ARRAY_SIZE(implementations); ++i) {
--
2.37.2
More information about the U-Boot
mailing list