[linux-next:master 5890/8170] drivers/pci/pci.h:359:23: sparse: sparse: incorrect type in argument 2 (different base types)

kernel test robot lkp at intel.com
Wed Apr 24 06:57:13 PDT 2024


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5e4f84f18c4ee9b0ccdc19e39b7de41df21699dd
commit: 99ce03b849f89ae2a00addf5b5475d2bb81972f6 [5890/8170] ARC: Emulate one-byte cmpxchg
config: arc-randconfig-r122-20240424 (https://download.01.org/0day-ci/archive/20240424/202404242144.8931hnhx-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240424/202404242144.8931hnhx-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404242144.8931hnhx-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   drivers/pci/pci-driver.c:520:42: sparse: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci-driver.c:520:61: sparse: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci-driver.c: note: in included file (through include/linux/pci.h):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   drivers/pci/pci-driver.c:389:19: sparse: sparse: self-comparison always evaluates to false
   drivers/pci/pci-driver.c: note: in included file:
>> drivers/pci/pci.h:359:23: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long [usertype] old @@     got restricted pci_channel_state_t _o_ @@
   drivers/pci/pci.h:359:23: sparse:     expected unsigned long [usertype] old
   drivers/pci/pci.h:359:23: sparse:     got restricted pci_channel_state_t _o_
>> drivers/pci/pci.h:359:23: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned long [usertype] new @@     got restricted pci_channel_state_t _n_ @@
   drivers/pci/pci.h:359:23: sparse:     expected unsigned long [usertype] new
   drivers/pci/pci.h:359:23: sparse:     got restricted pci_channel_state_t _n_
   drivers/pci/pci.h:359:23: sparse: sparse: cast to restricted pci_channel_state_t
   drivers/pci/pci.h:363:23: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long [usertype] old @@     got restricted pci_channel_state_t _o_ @@
   drivers/pci/pci.h:363:23: sparse:     expected unsigned long [usertype] old
   drivers/pci/pci.h:363:23: sparse:     got restricted pci_channel_state_t _o_
   drivers/pci/pci.h:363:23: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned long [usertype] new @@     got restricted pci_channel_state_t _n_ @@
   drivers/pci/pci.h:363:23: sparse:     expected unsigned long [usertype] new
   drivers/pci/pci.h:363:23: sparse:     got restricted pci_channel_state_t _n_
   drivers/pci/pci.h:363:23: sparse: sparse: cast to restricted pci_channel_state_t

vim +359 drivers/pci/pci.h

ac04840350e2c2 Lukas Wunner         2023-03-11  337  
a6bd101b8f84f9 Keith Busch          2018-09-20  338  /**
a6bd101b8f84f9 Keith Busch          2018-09-20  339   * pci_dev_set_io_state - Set the new error state if possible.
a6bd101b8f84f9 Keith Busch          2018-09-20  340   *
347269c113f10f Krzysztof Wilczyński 2021-07-03  341   * @dev: PCI device to set new error_state
347269c113f10f Krzysztof Wilczyński 2021-07-03  342   * @new: the state we want dev to be in
a6bd101b8f84f9 Keith Busch          2018-09-20  343   *
74ff8864cc842b Lukas Wunner         2023-01-20  344   * If the device is experiencing perm_failure, it has to remain in that state.
74ff8864cc842b Lukas Wunner         2023-01-20  345   * Any other transition is allowed.
a6bd101b8f84f9 Keith Busch          2018-09-20  346   *
a6bd101b8f84f9 Keith Busch          2018-09-20  347   * Returns true if state has been changed to the requested state.
a6bd101b8f84f9 Keith Busch          2018-09-20  348   */
a6bd101b8f84f9 Keith Busch          2018-09-20  349  static inline bool pci_dev_set_io_state(struct pci_dev *dev,
a6bd101b8f84f9 Keith Busch          2018-09-20  350  					pci_channel_state_t new)
a6bd101b8f84f9 Keith Busch          2018-09-20  351  {
74ff8864cc842b Lukas Wunner         2023-01-20  352  	pci_channel_state_t old;
a6bd101b8f84f9 Keith Busch          2018-09-20  353  
a6bd101b8f84f9 Keith Busch          2018-09-20  354  	switch (new) {
a6bd101b8f84f9 Keith Busch          2018-09-20  355  	case pci_channel_io_perm_failure:
74ff8864cc842b Lukas Wunner         2023-01-20  356  		xchg(&dev->error_state, pci_channel_io_perm_failure);
74ff8864cc842b Lukas Wunner         2023-01-20  357  		return true;
a6bd101b8f84f9 Keith Busch          2018-09-20  358  	case pci_channel_io_frozen:
74ff8864cc842b Lukas Wunner         2023-01-20 @359  		old = cmpxchg(&dev->error_state, pci_channel_io_normal,
74ff8864cc842b Lukas Wunner         2023-01-20  360  			      pci_channel_io_frozen);
74ff8864cc842b Lukas Wunner         2023-01-20  361  		return old != pci_channel_io_perm_failure;
a6bd101b8f84f9 Keith Busch          2018-09-20  362  	case pci_channel_io_normal:
74ff8864cc842b Lukas Wunner         2023-01-20  363  		old = cmpxchg(&dev->error_state, pci_channel_io_frozen,
74ff8864cc842b Lukas Wunner         2023-01-20  364  			      pci_channel_io_normal);
74ff8864cc842b Lukas Wunner         2023-01-20  365  		return old != pci_channel_io_perm_failure;
74ff8864cc842b Lukas Wunner         2023-01-20  366  	default:
74ff8864cc842b Lukas Wunner         2023-01-20  367  		return false;
a6bd101b8f84f9 Keith Busch          2018-09-20  368  	}
a6bd101b8f84f9 Keith Busch          2018-09-20  369  }
89ee9f7680031d Keith Busch          2017-03-29  370  

:::::: The code at line 359 was first introduced by commit
:::::: 74ff8864cc842be994853095dba6db48e716400a PCI: hotplug: Allow marking devices as disconnected during bind/unbind

:::::: TO: Lukas Wunner <lukas at wunner.de>
:::::: CC: Bjorn Helgaas <bhelgaas at google.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



More information about the linux-snps-arc mailing list