mtd: spi-nor: Fix the issue of buffer contamination

spi_nor_write_sr will pollute the buffer of sr_cr buffer when calling
spi_nor_read_sr.

Change-Id: I217141297df4f448b64c61f1573e7e40d6874903
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
Jon Lin
2024-04-22 09:50:04 +08:00
committed by Tao Huang
parent 75584d57e3
commit 21cd7557bd

View File

@@ -940,13 +940,12 @@ int spi_nor_write_16bit_cr_and_check(struct spi_nor *nor, u8 cr)
return ret;
sr_cr[1] = cr;
sr_written = sr_cr[0];
ret = spi_nor_write_sr(nor, sr_cr, 2);
if (ret)
return ret;
sr_written = sr_cr[0];
ret = spi_nor_read_sr(nor, sr_cr);
if (ret)
return ret;