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

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

 



Hello Lad Prabhakar,

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))'

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.

PIN_CFG_MASK is GENMASK_ULL(46, 0) which further suggests that the high
32 bits are important.

    375         }
    376 
    377         return 0;
    378 }

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