diff options
author | Tudor Ambarus <tudor.ambarus@linaro.org> | 2023-03-31 09:46:04 +0200 |
---|---|---|
committer | Tudor Ambarus <tudor.ambarus@linaro.org> | 2023-04-04 08:43:50 +0200 |
commit | 37513c56139b79dd43c1774513c28f8ab2b05224 (patch) | |
tree | 0d6918b33282b05c24f54ae9f0d83c54c40e861e /drivers | |
parent | mtd: spi-nor: Stop exporting spi_nor_restore() (diff) | |
download | linux-37513c56139b79dd43c1774513c28f8ab2b05224.tar.xz linux-37513c56139b79dd43c1774513c28f8ab2b05224.zip |
mtd: spi-nor: core: Update flash's current address mode when changing address mode
The bug was obswerved while reading code. There are not many users of
addr_mode_nbytes. Anyway, we should update the flash's current address
mode when changing the address mode, fix it. We don't care for now about
the set_4byte_addr_mode(nor, false) from spi_nor_restore(), as it is
used at driver remove and shutdown.
Fixes: d7931a215063 ("mtd: spi-nor: core: Track flash's internal address mode")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230331074606.3559258-9-tudor.ambarus@linaro.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/spi-nor/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 75a7839af034..b20c690a24d7 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3136,6 +3136,7 @@ static int spi_nor_quad_enable(struct spi_nor *nor) static int spi_nor_init(struct spi_nor *nor) { + struct spi_nor_flash_parameter *params = nor->params; int err; err = spi_nor_octal_dtr_enable(nor, true); @@ -3177,9 +3178,10 @@ static int spi_nor_init(struct spi_nor *nor) */ WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, "enabling reset hack; may not recover from unexpected reboots\n"); - err = nor->params->set_4byte_addr_mode(nor, true); + err = params->set_4byte_addr_mode(nor, true); if (err && err != -ENOTSUPP) return err; + params->addr_mode_nbytes = 4; } return 0; |