[PATCH] mtd: spi-nor: swp: remove unnecessary else after return
Michael Walle
mwalle at kernel.org
Fri Oct 23 02:29:07 PDT 2026
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 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 297 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20261023/610e2499/attachment.sig>
More information about the linux-mtd
mailing list