drivers: flash: report if the read returns an error

This matches the other commands that log on error.

Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
Michael Hope 2020-05-31 18:17:34 +02:00 committed by Carles Cufí
commit d0f87fa9d8

View file

@ -156,7 +156,11 @@ static int cmd_read(const struct shell *shell, size_t argc, char *argv[])
while (cnt--) {
uint32_t data;
flash_read(flash_dev, addr, &data, sizeof(data));
ret = flash_read(flash_dev, addr, &data, sizeof(data));
if (ret != 0) {
shell_error(shell, "Read ERROR!");
return -EIO;
}
shell_print(shell, "0x%08x ", data);
addr += sizeof(data);
}