diff mbox series

cmd: sbi: Correctly display unknown implementation IDs

Message ID 20240306144402.175957-1-heinrich.schuchardt@canonical.com
State Accepted
Commit 4de6d37fa289a4da32a395e5cc97a6649b948144
Delegated to: Andes
Headers show
Series cmd: sbi: Correctly display unknown implementation IDs | expand

Commit Message

Heinrich Schuchardt March 6, 2024, 2:44 p.m. UTC
For an unknown implementation ID an output like

    SBI 1.0Unknown implementation ID 16777216
    Extensions:
      sbi_set_timer
      ...

was shown. The number 16777216 is not the implementation ID.

* Show the correct number
* Use a hexadecimal output format
* Add a missing line feed

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/riscv/sbi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Conor Dooley March 6, 2024, 3:22 p.m. UTC | #1
On Wed, Mar 06, 2024 at 03:44:02PM +0100, Heinrich Schuchardt wrote:
> For an unknown implementation ID an output like
> 
>     SBI 1.0Unknown implementation ID 16777216
>     Extensions:
>       sbi_set_timer
>       ...
> 
> was shown. The number 16777216 is not the implementation ID.
> 
> * Show the correct number
> * Use a hexadecimal output format
> * Add a missing line feed
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

>  cmd/riscv/sbi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
> index 9daf0e247ad..87f7966f06b 100644
> --- a/cmd/riscv/sbi.c
> +++ b/cmd/riscv/sbi.c
> @@ -99,7 +99,7 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
>  			}
>  		}
>  		if (i == ARRAY_SIZE(implementations))
> -			printf("Unknown implementation ID %ld", ret);
> +			printf("\nUnknown implementation ID 0x%x", impl_id);
>  	}
>  	printf("\nMachine:\n");
>  	ret = sbi_get_mvendorid(&mvendorid);
> -- 
> 2.43.0
>
Dan Carpenter March 7, 2024, 11:36 a.m. UTC | #2
On Wed, Mar 06, 2024 at 03:44:02PM +0100, Heinrich Schuchardt wrote:
> For an unknown implementation ID an output like
> 
>     SBI 1.0Unknown implementation ID 16777216
>     Extensions:
>       sbi_set_timer
>       ...
> 
> was shown. The number 16777216 is not the implementation ID.
> 
> * Show the correct number
> * Use a hexadecimal output format
> * Add a missing line feed
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

Fixes: 89a86dcf6191 ("cmd: sbi: show SBI implementation version")

regards,
dan carpenter
diff mbox series

Patch

diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 9daf0e247ad..87f7966f06b 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -99,7 +99,7 @@  static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
 			}
 		}
 		if (i == ARRAY_SIZE(implementations))
-			printf("Unknown implementation ID %ld", ret);
+			printf("\nUnknown implementation ID 0x%x", impl_id);
 	}
 	printf("\nMachine:\n");
 	ret = sbi_get_mvendorid(&mvendorid);