[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 SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux