Re: [PATCH] mtd: spi-nor: swp: remove unnecessary else after return
From: Michael Walle
Date: Fri Oct 23 2026 - 05:29:24 EST
On Fri Oct 23, 2026 at 11:24 AM CEST, Shuai Liu wrote:
> 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.
So what is the checkpatch warning? IMHO that change make the
readability worse.
-michael
>
> Signed-off-by: Shuai Liu <847807867@xxxxxx>
> ---
> 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)
Attachment:
signature.asc
Description: PGP signature