]> git.baikalelectronics.ru Git - uboot.git/commit
cmd: mvebu/bubt: Correctly propagate failure during tftp transport
authorPali Rohár <pali@kernel.org>
Tue, 26 Jul 2022 14:11:57 +0000 (16:11 +0200)
committerStefan Roese <sr@denx.de>
Fri, 29 Jul 2022 08:02:43 +0000 (10:02 +0200)
commit8a58ac45e3c01d154bb6da16cd17e06aaa2406cf
treebcc2a752e3f7a4b6620eb2d0dcd2ba401c39ea1a
parent30d53de20e3dae5b552680a793b1359912852d74
cmd: mvebu/bubt: Correctly propagate failure during tftp transport

net_loop() returns signed int type and negative value represents error.
tftp_read_file() returns unsigned size_t type and zero value represents
error. Casting signed negative value to unsigned size_t type cause losing
information about error and bubt thinks that no error happened, and
continue erasing SPI-NOR which cause malfunction device.

Fix this issue by correctly propagating failure during tftp transport.

With this change when there is no eth link, bubt does not erase SPI-NOR
anymore.

  => bubt
  Burning U-Boot image "flash-image.bin" from "tftp" to "spi"
  ethernet@30000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
  ethernet@30000: No link.
  Error: Failed to read file flash-image.bin from tftp

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
cmd/mvebu/bubt.c