[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VfiTCCa+Rjn4JavxvSziNmjBTXEgUq-UT+PHkD8__5dhw@mail.gmail.com>
Date: Sun, 7 Jan 2024 21:46:24 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: wens@...e.org
Cc: kernel test robot <lkp@...el.com>, Aidan MacDonald <aidanmacdonald.0x0@...il.com>,
oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: drivers/iio/adc/axp20x_adc.c:572:26: sparse: sparse: dubious: x & !y
On Sun, Jan 7, 2024 at 7:37 AM Chen-Yu Tsai <wens@...e.org> wrote:
> On Sun, Jan 7, 2024 at 9:30 AM kernel test robot <lkp@...el.com> wrote:
...
> > sparse warnings: (new ones prefixed by >>)
> > >> drivers/iio/adc/axp20x_adc.c:572:26: sparse: sparse: dubious: x & !y
> > drivers/iio/adc/axp20x_adc.c:577:26: sparse: sparse: dubious: x & !y
>
> This looks like a false positive. The code is doing exactly what we want:
> val = val ? 1 : 0, but in a shorter format.
Yes, but the problem is that FIELD_PREP() is a macro.
You can replace these by ternary (here and in other cases) to satisfy
sparse. Compiler will optimize that anyway, so no branch is expected
in the generated code.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists