From: Pratyush Yadav <p.yadav@ti.com>
To: Nathan Rossi <nathan@nathanrossi.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
Nathan Rossi <nathan.rossi@digi.com>,
Tudor Ambarus <tudor.ambarus@microchip.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH] mtd: spi-nor: core: Fix 16bit write sr_and_check status check
Date: Fri, 1 Apr 2022 00:34:02 +0530 [thread overview]
Message-ID: <20220331190402.d3fymx3msnzyycef@ti.com> (raw)
In-Reply-To: <20220324070004.225738-1-nathan@nathanrossi.com>
Hi Nathan,
On 24/03/22 07:00AM, Nathan Rossi wrote:
> From: Nathan Rossi <nathan.rossi@digi.com>
>
> The spi_nor_write_16bit_sr_and_check function description describes that
> the function compares the value of the status and config registers after
> the write. However the function does not implement the status register
> compare only the config register check.
>
> This causes the function to differ in behaviour to the equivalent
> spi_nor_write_sr1_and_check for non-16bit writes to the status register.
> This is important as other functions rely on the return code of
> spi_nor_write_sr_and_check. For example spi_nor_sr_unlock returns the
> result directly, which is returned to userspace such that failing to
> unlock the spi-nor device was resulting in a return code of 0 instead of
> the expected non-zero indicating the failure.
>
> Signed-off-by: Nathan Rossi <nathan.rossi@digi.com>
> ---
> drivers/mtd/spi-nor/core.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 04ea180118..d75d4f8a45 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1007,6 +1007,15 @@ static int spi_nor_write_16bit_sr_and_check(struct spi_nor *nor, u8 sr1)
> if (ret)
> return ret;
>
> + ret = spi_nor_read_sr(nor, sr_cr);
> + if (ret)
> + return ret;
> +
> + if (sr1 != sr_cr[0]) {
> + dev_dbg(nor->dev, "SR: read back test failed\n");
> + return -EIO;
> + }
> +
> if (nor->flags & SNOR_F_NO_READ_CR)
> return 0;
This patch seems exactly like [0]. I will pick that one if it applies on
the current tree since it already has one Reviewed-by.
[0] https://lore.kernel.org/linux-mtd/20220126073227.3401275-1-chentsung@chromium.org/
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
prev parent reply other threads:[~2022-03-31 19:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 7:00 Nathan Rossi
2022-03-31 19:04 ` Pratyush Yadav [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220331190402.d3fymx3msnzyycef@ti.com \
--to=p.yadav@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=nathan.rossi@digi.com \
--cc=nathan@nathanrossi.com \
--cc=richard@nod.at \
--cc=tudor.ambarus@microchip.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®