drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1445:2-9: opportunity for str_enabled_disabled(enabled)
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3eb40771c00a8488fa6ed2cc1fe203477908bf38 commit: 2a9c5154a5650c09ad44ff5e1dff74754e15a3c6 drm/amdgpu: check ASPM on the dGPU host link date: 4 days ago config: x86_64-randconfig-104-20260816 (https://download.01.org/0day-ci/archive/20260816/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 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 | Fixes: 2a9c5154a565 ("drm/amdgpu: check ASPM on the dGPU host link") | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ cocci warnings: (new ones prefixed by >>) >> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1445:2-9: opportunity for str_enabled_disabled(enabled) vim +1445 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 1397 1398 /** 1399 * amdgpu_device_should_use_aspm - check if the device should program ASPM 1400 * 1401 * @adev: amdgpu_device pointer 1402 * 1403 * Confirm whether the module parameter and pcie bridge agree that ASPM should 1404 * be set for this device. 1405 * 1406 * Returns true if it should be used or false if not. 1407 */ 1408 bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev) 1409 { 1410 struct pci_dev *aspm_pdev, *parent; 1411 bool enabled; 1412 1413 switch (amdgpu_aspm) { 1414 case -1: 1415 break; 1416 case 0: 1417 return false; 1418 case 1: 1419 return true; 1420 default: 1421 return false; 1422 } 1423 if (adev->flags & AMD_IS_APU) 1424 return false; 1425 if (amdgpu_device_aspm_support_quirk(adev)) 1426 return false; 1427 1428 /* 1429 * pcie_aspm_enabled() checks the link between its argument and 1430 * the immediate upstream bridge. Use SWUS for dGPUs with an 1431 * internal switch so that this is the host-facing link. 1432 */ 1433 aspm_pdev = amdgpu_device_get_aspm_pdev(adev); 1434 parent = pci_upstream_bridge(aspm_pdev); 1435 if (!parent) { 1436 dev_dbg(adev->dev, "ASPM: no upstream PCIe link for %s\n", 1437 pci_name(aspm_pdev)); 1438 return false; 1439 } 1440 1441 enabled = pcie_aspm_enabled(aspm_pdev); 1442 /* Report the exact link used for the automatic ASPM decision. */ 1443 dev_dbg(adev->dev, "ASPM: link %s <-> %s is %s\n", 1444 pci_name(parent), pci_name(aspm_pdev), > 1445 enabled ? "enabled" : "disabled"); 1446 1447 return enabled; 1448 } 1449 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki