m25p80: Improve error when the backend file size does not match the device
commit11aeb4b8c125d20181421fe2996d36285c5d62f7
authorCédric Le Goater <clg@kaod.org>
Tue, 7 Mar 2023 15:53:18 +0000 (7 16:53 +0100)
committerCédric Le Goater <clg@kaod.org>
Tue, 7 Mar 2023 15:53:18 +0000 (7 16:53 +0100)
tree2aaab2ed0e0d5a767d912436e8fabc1c5ee43e53
parent817fd33836e73812df2f1907612b57750fcb9491
m25p80: Improve error when the backend file size does not match the device

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.

Instead, use helper blk_check_size_and_read_all() introduced by commit
06f1521795 ("pflash: Require backend size to match device, improve
errors").

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