public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask
@ 2026-01-28 12:42 Shiji Yang
  2026-01-28 14:11 ` Miquel Raynal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shiji Yang @ 2026-01-28 12:42 UTC (permalink / raw)
  To: linux-mtd
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-kernel, Shiji Yang

When the chip does not support top/bottom block protect, the tb_mask
must be set to 0, otherwise SR1 bit5 will be unexpectedly modified.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
---
 drivers/mtd/spi-nor/swp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/swp.c b/drivers/mtd/spi-nor/swp.c
index 9b07f83ae..e67a81dbb 100644
--- a/drivers/mtd/spi-nor/swp.c
+++ b/drivers/mtd/spi-nor/swp.c
@@ -28,8 +28,10 @@ static u8 spi_nor_get_sr_tb_mask(struct spi_nor *nor)
 {
 	if (nor->flags & SNOR_F_HAS_SR_TB_BIT6)
 		return SR_TB_BIT6;
-	else
+	else if (nor->flags & SNOR_F_HAS_SR_TB)
 		return SR_TB_BIT5;
+	else
+		return 0;
 }
 
 static u64 spi_nor_get_min_prot_length_sr(struct spi_nor *nor)
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask
  2026-01-28 12:42 [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask Shiji Yang
@ 2026-01-28 14:11 ` Miquel Raynal
  2026-02-09 10:31 ` Michael Walle
  2026-03-13 11:15 ` Pratyush Yadav
  2 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-01-28 14:11 UTC (permalink / raw)
  To: Shiji Yang
  Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Richard Weinberger, Vignesh Raghavendra, linux-kernel

On 28/01/2026 at 20:42:56 +08, Shiji Yang <yangshiji66@outlook.com> wrote:

> When the chip does not support top/bottom block protect, the tb_mask
> must be set to 0, otherwise SR1 bit5 will be unexpectedly modified.
>
> Signed-off-by: Shiji Yang <yangshiji66@outlook.com>

Good point.

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask
  2026-01-28 12:42 [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask Shiji Yang
  2026-01-28 14:11 ` Miquel Raynal
@ 2026-02-09 10:31 ` Michael Walle
  2026-03-13 11:15 ` Pratyush Yadav
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2026-02-09 10:31 UTC (permalink / raw)
  To: Shiji Yang, linux-mtd
  Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

On Wed Jan 28, 2026 at 1:42 PM CET, Shiji Yang wrote:
> When the chip does not support top/bottom block protect, the tb_mask
> must be set to 0, otherwise SR1 bit5 will be unexpectedly modified.
>
> Signed-off-by: Shiji Yang <yangshiji66@outlook.com>

It goes all the way back to the very first commit..

Fixes: 3dd8012a8eeb ("mtd: spi-nor: add TB (Top/Bottom) protect support")
Reviewed-by: Michael Walle <mwalle@kernel.org>

-michael

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask
  2026-01-28 12:42 [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask Shiji Yang
  2026-01-28 14:11 ` Miquel Raynal
  2026-02-09 10:31 ` Michael Walle
@ 2026-03-13 11:15 ` Pratyush Yadav
  2 siblings, 0 replies; 4+ messages in thread
From: Pratyush Yadav @ 2026-03-13 11:15 UTC (permalink / raw)
  To: Shiji Yang
  Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	linux-kernel

On Wed, Jan 28 2026, Shiji Yang wrote:

> When the chip does not support top/bottom block protect, the tb_mask
> must be set to 0, otherwise SR1 bit5 will be unexpectedly modified.
>
> Signed-off-by: Shiji Yang <yangshiji66@outlook.com>

Applied to spi-nor/next. Thanks!

[...]

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-13 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-28 12:42 [PATCH] mtd: spi-nor: swp: check SR_TB flag when getting tb_mask Shiji Yang
2026-01-28 14:11 ` Miquel Raynal
2026-02-09 10:31 ` Michael Walle
2026-03-13 11:15 ` Pratyush Yadav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox