drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c:920:3-56: opportunity for str_enabled_disabled(smu_feature_bits_is_set ( & feature_mask , feature_index ))

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:   b95f03f04d475aa6719d15a636ddf32222d55657
commit: 7b88453a476c9770c094c1f596e0b9fee208e65b drm/amd/pm: Change get_enabled_mask signature
date:   6 months ago
config: powerpc64-randconfig-r064-20260716 (https://download.01.org/0day-ci/archive/20260721/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project b3e6e6dabdc02153552a64fc74ff5c7532447eed)

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: 7b88453a476c ("drm/amd/pm: Change get_enabled_mask signature")
| 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/pm/swsmu/smu_cmn.c:920:3-56: opportunity for str_enabled_disabled(smu_feature_bits_is_set ( & feature_mask , feature_index ))

vim +920 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c

   878	
   879	size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
   880					   char *buf)
   881	{
   882		int8_t sort_feature[MAX(SMU_FEATURE_COUNT, SMU_FEATURE_MAX)];
   883		struct smu_feature_bits feature_mask;
   884		uint32_t features[2];
   885		int i, feature_index;
   886		uint32_t count = 0;
   887		size_t size = 0;
   888	
   889		if (__smu_get_enabled_features(smu, &feature_mask))
   890			return 0;
   891	
   892		/* TBD: Need to handle for > 64 bits */
   893		smu_feature_bits_to_arr32(&feature_mask, features, 64);
   894		size = sysfs_emit_at(buf, size, "features high: 0x%08x low: 0x%08x\n",
   895				     features[1], features[0]);
   896	
   897		memset(sort_feature, -1, sizeof(sort_feature));
   898	
   899		for (i = 0; i < SMU_FEATURE_COUNT; i++) {
   900			feature_index = smu_cmn_to_asic_specific_index(smu,
   901								       CMN2ASIC_MAPPING_FEATURE,
   902								       i);
   903			if (feature_index < 0)
   904				continue;
   905	
   906			sort_feature[feature_index] = i;
   907		}
   908	
   909		size += sysfs_emit_at(buf, size, "%-2s. %-20s  %-3s : %-s\n",
   910				"No", "Feature", "Bit", "State");
   911	
   912		for (feature_index = 0; feature_index < SMU_FEATURE_MAX; feature_index++) {
   913			if (sort_feature[feature_index] < 0)
   914				continue;
   915	
   916			size += sysfs_emit_at(
   917				buf, size, "%02d. %-20s (%2d) : %s\n", count++,
   918				smu_get_feature_name(smu, sort_feature[feature_index]),
   919				feature_index,
 > 920				smu_feature_bits_is_set(&feature_mask, feature_index) ?
   921					"enabled" :
   922					"disabled");
   923		}
   924	
   925		return size;
   926	}
   927	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.