drivers/gpu/drm/amd/pm/amdgpu_pm.c:2248:32-38: opportunity for str_enabled_disabled(npower)

From: kernel test robot

Date: Wed Mar 25 2026 - 02:35:28 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bbeb83d3182abe0d245318e274e8531e5dd7a948
commit: ef612f58d944ce4a468fa533335035a6e5163eda drm/amd/pm: Add sysfs node for node power
date: 6 months ago
config: s390-randconfig-r052-20260323 (https://download.01.org/0day-ci/archive/20260325/202603251434.zIN2QYWn-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project c911b8492374942bf4cfe35411e90a35d3837f6a)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603251434.zIN2QYWn-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/amd/pm/amdgpu_pm.c:2248:32-38: opportunity for str_enabled_disabled(npower)
drivers/gpu/drm/amd/pm/amdgpu_pm.c:1600:5-51: opportunity for str_enabled_disabled(atomic_read ( & adev -> throttling_logging_enabled ))

vim +2248 drivers/gpu/drm/amd/pm/amdgpu_pm.c

2226
2227 /**
2228 * DOC: npm_status
2229 *
2230 * The amdgpu driver provides a sysfs API for retrieving current node power management status.
2231 * The file npm_status is used for this. It shows the status as enabled or disabled based on
2232 * current node power value. If node power is zero, status is disabled else enabled.
2233 */
2234 static ssize_t amdgpu_show_npm_status(struct device *dev,
2235 struct device_attribute *attr, char *buf)
2236 {
2237 struct drm_device *ddev = dev_get_drvdata(dev);
2238 struct amdgpu_device *adev = drm_to_adev(ddev);
2239 u32 npower;
2240 int r;
2241
2242 /* get the node power */
2243 r = amdgpu_pm_get_sensor_generic(adev, AMDGPU_PP_SENSOR_NODEPOWER,
2244 (void *)&npower);
2245 if (r)
2246 return r;
2247
> 2248 return sysfs_emit(buf, "%s\n", npower ? "enabled" : "disabled");
2249 }
2250

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