[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/25] m25p80: Improve error when the backend file size does not
From: |
Cédric Le Goater |
Subject: |
[PATCH 01/25] m25p80: Improve error when the backend file size does not match the device |
Date: |
Thu, 19 Jan 2023 13:34:25 +0100 |
Currently, when a block backend is attached to a m25p80 device and the
associated file size does not match the flash model, QEMU complains
with the error message "failed to read the initial flash content".
This is confusing for the user.
Use blk_check_size_and_read_all() instead of blk_pread() to improve
the reported error.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20221115151000.2080833-1-clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/block/m25p80.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 02adc87527..68a757abf3 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
#include "sysemu/block-backend.h"
+#include "hw/block/block.h"
#include "hw/qdev-properties.h"
#include "hw/qdev-properties-system.h"
#include "hw/ssi/ssi.h"
@@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error
**errp)
trace_m25p80_binding(s);
s->storage = blk_blockalign(s->blk, s->size);
- if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
- error_setg(errp, "failed to read the initial flash content");
+ if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
return;
}
} else {
--
2.39.0
- [PATCH 00/25] aspeed: Various extensions, fixes and cleanups, Cédric Le Goater, 2023/01/19
- [PATCH 01/25] m25p80: Improve error when the backend file size does not match the device,
Cédric Le Goater <=
- [PATCH 03/25] hw/net: Fix read of uninitialized memory in ftgmac100, Cédric Le Goater, 2023/01/19
- [PATCH 04/25] avocado/boot_linux_console.py: Update ast2600 test, Cédric Le Goater, 2023/01/19
- [PATCH 02/25] aspeed: Add Supermicro X11 SPI machine type, Cédric Le Goater, 2023/01/19
- [PATCH 06/25] tests/avocado/machine_aspeed.py: update buildroot tests, Cédric Le Goater, 2023/01/19
- [PATCH 05/25] m25p80: Add the is25wp256 SFPD table, Cédric Le Goater, 2023/01/19
- [PATCH 07/25] tests/avocado/machine_aspeed.py: Mask systemd services to speed up SDK boot, Cédric Le Goater, 2023/01/19
- [PATCH 08/25] hw/arm/boot: Export write_bootloader for Aspeed machines, Cédric Le Goater, 2023/01/19
- [PATCH 09/25] hw/core/loader: Remove declarations of option_rom_has_mr/rom_file_has_mr, Cédric Le Goater, 2023/01/19
- [PATCH 10/25] hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards, Cédric Le Goater, 2023/01/19
- [PATCH 11/25] hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init, Cédric Le Goater, 2023/01/19