]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: spi-nor: swp: Create a TB intermediate variable
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 26 May 2026 14:56:37 +0000 (16:56 +0200)
committerPratyush Yadav <pratyush@kernel.org>
Tue, 26 May 2026 15:21:04 +0000 (17:21 +0200)
Ease the future reuse of the tb (Top/Bottom) boolean by creating an
intermediate variable.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
drivers/mtd/spi-nor/swp.c

index 07269e09370ac70250dd0bfd44fee199485f77ab..540cd221c455bd13e4c8eb7c2d8fb76cec3e3b6b 100644 (file)
@@ -62,6 +62,7 @@ static void spi_nor_get_locked_range_sr(struct spi_nor *nor, const u8 *sr, loff_
        u8 bp_mask = spi_nor_get_sr_bp_mask(nor);
        u8 tb_mask = spi_nor_get_sr_tb_mask(nor);
        u8 bp, val = sr[0] & bp_mask;
+       bool tb = (nor->flags & SNOR_F_HAS_SR_TB) ? sr[0] & tb_mask : 0;
 
        if (nor->flags & SNOR_F_HAS_SR_BP3_BIT6 && val & SR_BP3_BIT6)
                val = (val & ~SR_BP3_BIT6) | SR_BP3;
@@ -81,7 +82,7 @@ static void spi_nor_get_locked_range_sr(struct spi_nor *nor, const u8 *sr, loff_
        if (*len > nor->params->size)
                *len = nor->params->size;
 
-       if (nor->flags & SNOR_F_HAS_SR_TB && sr[0] & tb_mask)
+       if (tb)
                *ofs = 0;
        else
                *ofs = nor->params->size - *len;