From: kernel test robot <lkp@intel.com>
To: Yang Wang <kevinyang.wang@amd.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Alex Deucher <alexander.deucher@amd.com>,
Hawking Zhang <Hawking.Zhang@amd.com>,
Kenneth Feng <kenneth.feng@amd.com>
Subject: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1445:2-9: opportunity for str_enabled_disabled(enabled)
Date: Sun, 16 Aug 2026 17:31:23 +0800 [thread overview]
Message-ID: <202608161707.IAEa5YkL-lkp@intel.com> (raw)
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/202608161707.IAEa5YkL-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608161707.IAEa5YkL-lkp@intel.com/
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
reply other threads:[~2026-08-16 9:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202608161707.IAEa5YkL-lkp@intel.com \
--to=lkp@intel.com \
--cc=Hawking.Zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=kenneth.feng@amd.com \
--cc=kevinyang.wang@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®