aboutsummaryrefslogtreecommitdiff
path: root/hw/block/m25p80.c
diff options
context:
space:
mode:
authorBin Meng <bin.meng@windriver.com>2020-12-23 10:00:24 +0800
committerAlistair Francis <alistair.francis@wdc.com>2021-01-16 10:57:21 -0800
commit1695854b371cdd4d17835a406675245a8dfe6cff (patch)
tree9e706dc05e6c6435e5bca49de0eb0177de5e2109 /hw/block/m25p80.c
parent825a215c003cd028e26c7d19aa5049d957345f43 (diff)
hw/block: m25p80: Don't write to flash if write is disabled
When write is disabled, the write to flash should be avoided in flash_write8(). Fixes: 82a2499011a7 ("m25p80: Initial implementation of SPI flash device") Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> Message-id: 1608688825-81519-1-git-send-email-bmeng.cn@gmail.com Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'hw/block/m25p80.c')
-rw-r--r--hw/block/m25p80.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 1b3f2405a1..63278cbda5 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -601,6 +601,7 @@ void flash_write8(Flash *s, uint32_t addr, uint8_t data)
if (!s->write_enable) {
qemu_log_mask(LOG_GUEST_ERROR, "M25P80: write with write protect!\n");
+ return;
}
if ((prev ^ data) & data) {