Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mtd: spi-nor: swp: check SR_TB flag when getting tb_mask

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>
Fixes: 3dd8012a8eeb ("mtd: spi-nor: add TB (Top/Bottom) protect support")
Reviewed-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>

authored by

Shiji Yang and committed by
Pratyush Yadav (Google)
94645aa4 6d660fba

+3 -1
+3 -1
drivers/mtd/spi-nor/swp.c
··· 28 28 { 29 29 if (nor->flags & SNOR_F_HAS_SR_TB_BIT6) 30 30 return SR_TB_BIT6; 31 - else 31 + else if (nor->flags & SNOR_F_HAS_SR_TB) 32 32 return SR_TB_BIT5; 33 + else 34 + return 0; 33 35 } 34 36 35 37 static u64 spi_nor_get_min_prot_length_sr(struct spi_nor *nor)