From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BE2E168C5 for ; Mon, 8 May 2023 10:52:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61F6FC433EF; Mon, 8 May 2023 10:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683543170; bh=5fQ5y72D87pbjtsucMhK2m9RxRbYB2ED2k1h/yzN+fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRNOoiRZ4FgAyyEH+gGkFDaCWENxxsFZg+YeQNVXoGRQu8N495LQnLt2p0TVm+3Wc u8p0/30UQfqWuaKBR7TsbtmTRmLea2xi90CHria4XAW55GNotWk/VP7iNRoPzl7Dh8 L1zpQ+5jRNrOO4KuAI6dzYOWchf/NkrIB54e0eMk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tudor Ambarus Subject: [PATCH 6.2 628/663] mtd: spi-nor: core: Update flashs current address mode when changing address mode Date: Mon, 8 May 2023 11:47:34 +0200 Message-Id: <20230508094450.237775518@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230508094428.384831245@linuxfoundation.org> References: <20230508094428.384831245@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Tudor Ambarus 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 Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/spi-nor/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2733,6 +2733,7 @@ static int spi_nor_quad_enable(struct sp 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); @@ -2774,9 +2775,10 @@ static int spi_nor_init(struct spi_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;