drivers/ufs/host/ufs-mediatek.c:1351:32-33: WARNING: Use ARRAY_SIZE

From: kernel test robot

Date: Thu Nov 19 2026 - 14:44:07 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8dac6df92a2e66e2098bbc69061964cfe7e8375b
commit: 1fd05367d5b1a5edd3d14c966a5f510e5b8a0c5e scsi: ufs: host: mediatek: Adjust sync length for FASTAUTO mode
date: 1 year, 1 month ago
config: arm64-randconfig-r2107-20261115 (https://download.01.org/0day-ci/archive/20261119/20261119203207.ZZFIVGcA-lkp@xxxxxxxxx/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project c0693becb96c1610aeb87445a50df00d58a823cd)

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: 1fd05367d5b1 ("scsi: ufs: host: mediatek: Adjust sync length for FASTAUTO mode")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261119203207.ZZFIVGcA-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/ufs/host/ufs-mediatek.c:1351:32-33: WARNING: Use ARRAY_SIZE

vim +1351 drivers/ufs/host/ufs-mediatek.c

1334
1335 static void ufs_mtk_adjust_sync_length(struct ufs_hba *hba)
1336 {
1337 int i;
1338 u32 value;
1339 u32 cnt, att, min;
1340 struct attr_min {
1341 u32 attr;
1342 u32 min_value;
1343 } pa_min_sync_length[] = {
1344 {PA_TXHSG1SYNCLENGTH, 0x48},
1345 {PA_TXHSG2SYNCLENGTH, 0x48},
1346 {PA_TXHSG3SYNCLENGTH, 0x48},
1347 {PA_TXHSG4SYNCLENGTH, 0x48},
1348 {PA_TXHSG5SYNCLENGTH, 0x48}
1349 };
1350
> 1351 cnt = sizeof(pa_min_sync_length) / sizeof(struct attr_min);
1352 for (i = 0; i < cnt; i++) {
1353 att = pa_min_sync_length[i].attr;
1354 min = pa_min_sync_length[i].min_value;
1355 ufshcd_dme_get(hba, UIC_ARG_MIB(att), &value);
1356 if (value < min)
1357 ufshcd_dme_set(hba, UIC_ARG_MIB(att), min);
1358
1359 ufshcd_dme_peer_get(hba, UIC_ARG_MIB(att), &value);
1360 if (value < min)
1361 ufshcd_dme_peer_set(hba, UIC_ARG_MIB(att), min);
1362 }
1363 }
1364

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