mtd: spi-nor: core: Update flash's current address mode when changing address mode
authorTudor Ambarus <tudor.ambarus@linaro.org>
Fri, 31 Mar 2023 07:46:04 +0000 (07:46 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:40 +0000 (23:03 +0900)
commit8cc1ab7de21579ea5a42b4de98e4edcb8586328e
tree0c71f944c44bcc3ae8cc28652ee5ac7b5f80eb7e
parentf1b4affca1e13706ca2eb075bf6775421236d7d1
mtd: spi-nor: core: Update flash's current address mode when changing address mode

commit 37513c56139b79dd43c1774513c28f8ab2b05224 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/spi-nor/core.c