tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 21498d01d045c5b95b93e0a0625ae965b4330ebe commit: 0b59193548e63957101aae5e4fc47151fce4a629 [8567/12886] PCI/PM: Do not call pci_update_current_state() from pci_power_up() config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220520/202205200242.0hz9YoL8-lkp@xxxxxxxxx/config) compiler: gcc-11 (Debian 11.3.0-1) 11.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=0b59193548e63957101aae5e4fc47151fce4a629 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 0b59193548e63957101aae5e4fc47151fce4a629 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/pci/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> sparse warnings: (new ones prefixed by >>) drivers/pci/pci.c:1094:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted pci_power_t [usertype] current_state @@ got int @@ drivers/pci/pci.c:1094:36: sparse: expected restricted pci_power_t [usertype] current_state drivers/pci/pci.c:1094:36: sparse: got int >> drivers/pci/pci.c:1222:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted pci_power_t [assigned] [usertype] state @@ got int @@ drivers/pci/pci.c:1222:15: sparse: expected restricted pci_power_t [assigned] [usertype] state drivers/pci/pci.c:1222:15: sparse: got int drivers/pci/pci.c:1224:50: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1224:69: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1250:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted pci_power_t [usertype] current_state @@ got int @@ drivers/pci/pci.c:1250:28: sparse: expected restricted pci_power_t [usertype] current_state drivers/pci/pci.c:1250:28: sparse: got int drivers/pci/pci.c:1327:13: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1327:21: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1327:31: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1327:39: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1336:16: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1336:35: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1336:52: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1336:70: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1358:15: sparse: sparse: invalid assignment: |= drivers/pci/pci.c:1358:15: sparse: left side has type unsigned short drivers/pci/pci.c:1358:15: sparse: right side has type restricted pci_power_t drivers/pci/pci.c:1370:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted pci_power_t [usertype] current_state @@ got int @@ drivers/pci/pci.c:1370:28: sparse: expected restricted pci_power_t [usertype] current_state drivers/pci/pci.c:1370:28: sparse: got int drivers/pci/pci.c:1404:13: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1404:21: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1406:18: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1406:26: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1429:13: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1429:22: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1436:46: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1436:54: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:1781:38: sparse: sparse: array of flexible structures drivers/pci/pci.c:2357:44: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:2660:60: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:2661:30: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:2856:20: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:2856:38: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:2879:49: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:2879:67: sparse: sparse: restricted pci_power_t degrades to integer drivers/pci/pci.c:4834:13: sparse: sparse: invalid assignment: |= drivers/pci/pci.c:4834:13: sparse: left side has type unsigned short drivers/pci/pci.c:4834:13: sparse: right side has type restricted pci_power_t drivers/pci/pci.c:4839:13: sparse: sparse: invalid assignment: |= drivers/pci/pci.c:4839:13: sparse: left side has type unsigned short drivers/pci/pci.c:4839:13: sparse: right side has type restricted pci_power_t drivers/pci/pci.c:1049:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted pci_power_t [usertype] @@ drivers/pci/pci.c:1049:24: sparse: expected int drivers/pci/pci.c:1049:24: sparse: got restricted pci_power_t [usertype] drivers/pci/pci.c:1049:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted pci_power_t [usertype] @@ drivers/pci/pci.c:1049:24: sparse: expected int drivers/pci/pci.c:1049:24: sparse: got restricted pci_power_t [usertype] vim +1222 drivers/pci/pci.c 1188 1189 /** 1190 * pci_power_up - Put the given device into D0 1191 * @dev: PCI device to power up 1192 */ 1193 int pci_power_up(struct pci_dev *dev) 1194 { 1195 bool need_restore; 1196 pci_power_t state; 1197 u16 pmcsr; 1198 1199 platform_pci_set_power_state(dev, PCI_D0); 1200 1201 if (!dev->pm_cap) { 1202 state = platform_pci_get_power_state(dev); 1203 if (state == PCI_UNKNOWN) 1204 dev->current_state = PCI_D0; 1205 else 1206 dev->current_state = state; 1207 1208 if (state == PCI_D0) 1209 return 0; 1210 1211 return -EIO; 1212 } 1213 1214 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1215 if (PCI_POSSIBLE_ERROR(pmcsr)) { 1216 pci_err(dev, "Unable to change power state from %s to D0, device inaccessible\n", 1217 pci_power_name(dev->current_state)); 1218 dev->current_state = PCI_D3cold; 1219 return -EIO; 1220 } 1221 > 1222 state = pmcsr & PCI_PM_CTRL_STATE_MASK; 1223 1224 need_restore = (state == PCI_D3hot || dev->current_state >= PCI_D3hot) && 1225 !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET); 1226 1227 if (state == PCI_D0) { 1228 dev->current_state = PCI_D0; 1229 goto end; 1230 } 1231 1232 /* 1233 * If we're (effectively) in D3, force entire word to 0. This doesn't 1234 * affect PME_Status, disables PME_En, and sets PowerState to 0. 1235 */ 1236 if (state == PCI_D3hot) 1237 pmcsr = 0; 1238 else 1239 pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 1240 1241 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); 1242 1243 /* Mandatory transition delays; see PCI PM 1.2. */ 1244 if (state == PCI_D3hot) 1245 pci_dev_d3_sleep(dev); 1246 else if (state == PCI_D2) 1247 udelay(PCI_PM_D2_DELAY); 1248 1249 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1250 dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK; 1251 if (dev->current_state != PCI_D0) 1252 pci_info_ratelimited(dev, "Refused to change power state from %s to D0\n", 1253 pci_power_name(dev->current_state)); 1254 1255 end: 1256 /* 1257 * According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT 1258 * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning 1259 * from D3hot to D0 _may_ perform an internal reset, thereby 1260 * going to "D0 Uninitialized" rather than "D0 Initialized". 1261 * For example, at least some versions of the 3c905B and the 1262 * 3c556B exhibit this behaviour. 1263 * 1264 * At least some laptop BIOSen (e.g. the Thinkpad T21) leave 1265 * devices in a D3hot state at boot. Consequently, we need to 1266 * restore at least the BARs so that the device will be 1267 * accessible to its driver. 1268 */ 1269 if (need_restore) 1270 pci_restore_bars(dev); 1271 1272 if (dev->bus->self) 1273 pcie_aspm_pm_state_change(dev->bus->self); 1274 1275 return 0; 1276 } 1277 -- 0-DAY CI Kernel Test Service https://01.org/lkp