Skip to content

Commit 37513c5

Browse files
committed
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: d7931a2 ("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>
1 parent 7fe1b00 commit 37513c5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/mtd/spi-nor/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3136,6 +3136,7 @@ static int spi_nor_quad_enable(struct spi_nor *nor)
31363136

31373137
static int spi_nor_init(struct spi_nor *nor)
31383138
{
3139+
struct spi_nor_flash_parameter *params = nor->params;
31393140
int err;
31403141

31413142
err = spi_nor_octal_dtr_enable(nor, true);
@@ -3177,9 +3178,10 @@ static int spi_nor_init(struct spi_nor *nor)
31773178
*/
31783179
WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET,
31793180
"enabling reset hack; may not recover from unexpected reboots\n");
3180-
err = nor->params->set_4byte_addr_mode(nor, true);
3181+
err = params->set_4byte_addr_mode(nor, true);
31813182
if (err && err != -ENOTSUPP)
31823183
return err;
3184+
params->addr_mode_nbytes = 4;
31833185
}
31843186

31853187
return 0;

0 commit comments

Comments
 (0)