mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
spi: airoha: buffer must be 0xff-ed before writing
During writing, the entire flash page (including OOB) will be updated with the values from the temporary buffer, so we need to fill the untouched areas of the buffer with 0xff value to prevent accidental data overwriting. Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
This commit is contained in:
committed by
Michael Trimarchi
parent
531e1fe34b
commit
2996c2a7a8
@@ -819,7 +819,11 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (offs > 0)
|
||||
memset(txrx_buf, 0xff, offs);
|
||||
memcpy(txrx_buf + offs, buf, len);
|
||||
if (bytes > offs + len)
|
||||
memset(txrx_buf + offs + len, 0xff, bytes - offs - len);
|
||||
|
||||
err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
|
||||
if (err < 0)
|
||||
|
||||
Reference in New Issue
Block a user