Re: [bug report] pinctrl: renesas: rzg2l: Drop struct rzg2l_variable_pin_cfg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 17, 2024 at 02:54:13PM +0200, Geert Uytterhoeven wrote:
> Hi Prabhakar,
> 
> On Mon, Jun 17, 2024 at 2:47 PM Lad, Prabhakar
> <prabhakar.csengg@xxxxxxxxx> wrote:
> > On Mon, Jun 17, 2024 at 10:35 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> > > Commit 13a8cae6e561 ("pinctrl: renesas: rzg2l: Drop struct
> > > rzg2l_variable_pin_cfg") from May 30, 2024 (linux-next), leads to the
> > > following Smatch static checker warning:
> > >
> > >         drivers/pinctrl/renesas/pinctrl-rzg2l.c:374 rzg2l_pinctrl_get_variable_pin_cfg()
> > >         warn: was expecting a 64 bit value instead of '~((((1))) << (16))'
> > >
> > Is there any way I can replicate the same on my setup? I tried the
> > kcehker utility but it didn't print the above warning.
> >
> > > drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > >     362 static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl,
> > >     363                                               u64 pincfg,
> > >     364                                               unsigned int port,
> > >     365                                               u8 pin)
> > >     366 {
> > >     367         unsigned int i;
> > >     368
> > >     369         for (i = 0; i < pctrl->data->n_variable_pin_cfg; i++) {
> > >     370                 u64 cfg = pctrl->data->variable_pin_cfg[i];
> > >     371
> > >     372                 if (FIELD_GET(VARIABLE_PIN_CFG_PORT_MASK, cfg) == port &&
> > >     373                     FIELD_GET(VARIABLE_PIN_CFG_PIN_MASK, cfg) == pin)
> > > --> 374                         return (pincfg & ~PIN_CFG_VARIABLE) | FIELD_GET(PIN_CFG_MASK, cfg);
> > >
> > > pincfg is a u64 and we're returning a u64.  The code here is trying to
> > > mask out PIN_CFG_VARIABLE which is BIT(16).  But because it's BIT()
> > > instead of BIT_ULL(16) then it ends up masking the high 32 bits as well.
> 
> Note that there is no issue on 64-bit platforms (i.e. all affected
> platforms), as BIT() does produce a 64-bit value if unsigned long
> is 64-bit.
> 

Ah, yes, thanks.  I had forgotten that it was BIT() was UL.  I was doing
a 32bit build, yes.

regards,
dan carpenter





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux