qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 1/2] hw/block: m25p80: Don't write to flash if write is di


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v4 1/2] hw/block: m25p80: Don't write to flash if write is disabled
Date: Tue, 22 Dec 2020 15:25:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

On 12/22/20 7:45 AM, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> 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>
> 
> ---
> 
> (no changes since v2)
> 
> Changes in v2:
> - new patch: honor write enable flag in flash write
> 
>  hw/block/m25p80.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 483925f..236e1b4 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -594,6 +594,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) {
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]