Re: [PATCH] block: drop dead assignments in loop_init()
From: Joe Perches
Date: Fri Dec 11 2020 - 23:29:44 EST
On Fri, 2020-12-11 at 19:40 +0100, Lukas Bulwahn wrote:
> On Fri, Dec 11, 2020 at 7:23 PM Julia Lawall <julia.lawall@xxxxxxxx> wrote:
> > On Fri, 11 Dec 2020, Lukas Bulwahn wrote:
> > > Commit 8410d38c2552 ("loop: use __register_blkdev to allocate devices on
> > > demand") simplified loop_init(); so computing the range of the block region
> > > is not required anymore and can be dropped.
> > >
> > > Drop dead assignments in loop_init().
> > >
> > > As compilers will detect these unneeded assignments and optimize this,
> > > the resulting object code is identical before and after this change.
> > >
> > > No functional change. No change in object code.
> >
> > It looks like some braces should be dropped too?
> I just rewrote it to:
>
> nr = max_loop ? max_loop : CONFIG_BLK_DEV_LOOP_MIN_COUNT;
A relatively common gcc extension would use ?: like:
nr = max_loop ?: CONFIG_BLK_DEV_LOOP_MIN_COUNT;