[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb1bb7be6fad2dfb4bb3d311fddb39b13966311d.camel@perches.com>
Date: Mon, 15 Mar 2021 07:43:01 -0700
From: Joe Perches <joe@...ches.com>
To: Tudor.Ambarus@...rochip.com, p.yadav@...com
Cc: vigneshr@...com, michael@...le.cc, linux-mtd@...ts.infradead.org,
miquel.raynal@...tlin.com, richard@....at,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/5] mtd: spi-nor: swp: Drop 'else' after 'return'
On Mon, 2021-03-15 at 11:24 +0000, Tudor.Ambarus@...rochip.com wrote:
> On 3/15/21 8:53 AM, Joe Perches wrote:
> > On Mon, 2021-03-08 at 11:58 +0530, Pratyush Yadav wrote:
> > > On 06/03/21 11:50AM, Tudor Ambarus wrote:
> > > > else is not generally useful after a break or return.
> > > >
> > > > Signed-off-by: Tudor Ambarus <tudor.ambarus@...rochip.com>
> > >
> > > Reviewed-by: Pratyush Yadav <p.yadav@...com>
> > >
> >
> > I don't think this improves the code.
> >
> > Generally, checkpatch is a stupid little script.
> >
> > This code uses a form like:
> > if (foo)
> > return bar;
> > else
> > return baz;
>
> Isn't else redundant? What are the benefits of keeping the else?
Visual consistency and it's a widely used style.
A long time ago Al Viro wrote:
https://lore.kernel.org/lkml/20140925032215.GK7996@ZenIV.linux.org.uk/
which resulted in the patch to checkpatch that tries to ignore that style.
https://lore.kernel.org/lkml/1411621434.4026.9.camel@joe-AO725/
> > I think better would be to change the code to use temporaries
> > and convert the functions to bool.
> returning one is wrong indeed, would you submit a patch for the conversion
> of the functions to bool?
Just a suggestion...
Powered by blists - more mailing lists