[PATCH] mtd: spi-nor: swp: remove unnecessary else after return

Shuai Liu 847807867 at qq.com
Fri Oct 23 02:24:45 PDT 2026


Drop the else branch following an if that always returns, and move
the trailing comment onto the fall-through path. Cosmetic only, no
functional change; silences a checkpatch WARNING.

Signed-off-by: Shuai Liu <847807867 at qq.com>
---
 drivers/mtd/spi-nor/swp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/swp.c b/drivers/mtd/spi-nor/swp.c
index 235070b21..3b8176b9d 100644
--- a/drivers/mtd/spi-nor/swp.c
+++ b/drivers/mtd/spi-nor/swp.c
@@ -135,9 +135,9 @@ static bool spi_nor_check_lock_status_sr(struct spi_nor *nor, loff_t ofs,
 	if (locked)
 		/* Requested range is a sub-range of locked range */
 		return (offs_max <= lock_offs_max) && (ofs >= lock_offs);
-	else
-		/* Requested range does not overlap with locked range */
-		return (ofs >= lock_offs_max) || (offs_max <= lock_offs);
+
+	/* Requested range does not overlap with locked range */
+	return (ofs >= lock_offs_max) || (offs_max <= lock_offs);
 }
 
 bool spi_nor_is_locked_sr(struct spi_nor *nor, loff_t ofs, u64 len, const u8 *sr)
-- 
2.43.0




More information about the linux-mtd mailing list