Skip to content

Commit

Permalink
boot: fix bootdev_list()
Browse files Browse the repository at this point in the history
uclass_get_device_by_name() is meant to return 0 or a negative error code.
simple_itoa() cannot handle negative numbers.

This leads to output like:

    => bootdev list -p

    Seq  Probed  Status  Uclass    Name
    ---  ------  ------  --------  ------------------
      c   [   ]  18446744073709551614  spi_flash [email protected]

Convert the status to a positive number. Now we get

    Seq  Probed  Status  Uclass    Name
    ---  ------  ------  --------  ------------------
      c   [   ]       2  spi_flash [email protected]

Signed-off-by: Heinrich Schuchardt <[email protected]>
  • Loading branch information
xypron authored and sjg20 committed Aug 2, 2023
1 parent d4d9766 commit ca9d926
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion boot/bootdev-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void bootdev_list(bool probe)
for (i = 0; dev; i++) {
printf("%3x [ %c ] %6s %-9.9s %s\n", dev_seq(dev),
device_active(dev) ? '+' : ' ',
ret ? simple_itoa(ret) : "OK",
ret ? simple_itoa(-ret) : "OK",
dev_get_uclass_name(dev_get_parent(dev)), dev->name);
if (probe)
ret = uclass_next_device_check(&dev);
Expand Down

0 comments on commit ca9d926

Please sign in to comment.