arch/riscv/kernel/sbi_mpxy.c:103:19-20: WARNING opportunity for min() (fwd)
PATCH 46/61 arch/riscv/kernel/sbi_mpxy.c:103:19-20: WARNING opportunity for min() (fwd)
---------- Forwarded message ----------
Date: Fri, 29 May 2026 14:26:44 +0800
From: kernel test robot <[email protected]>
To: [email protected]
Cc: [email protected], Julia Lawall <[email protected]>
Subject: [avpatel:riscv_trace_support_v4 46/61]
arch/riscv/kernel/sbi_mpxy.c:103:19-20: WARNING opportunity for min()
BCC: [email protected]
CC: [email protected]
TO: Anup Patel <[email protected]>
CC: Himanshu Chauhan <[email protected]>
tree: https://github.com/avpatel/linux.git riscv_trace_support_v4 head: f532a039b5f6357db1cefa8fba19666b46049341 commit: d715c82481af6e5c6576ae0cb3a17bdb66a9e4ea [46/61] RISC-V: Move common MPXY helper routines to arch/riscv
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: riscv-randconfig-r061-20260529 (https://download.01.org/0day-ci/archive/20260529/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 14.3.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
| Reported-by: kernel test robot <[email protected]> | Reported-by: Julia Lawall <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
cocci warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
arch/riscv/kernel/sbi_mpxy.c:103:19-20: WARNING opportunity for
min()
vim +103 arch/riscv/kernel/sbi_mpxy.c
d715c82481af6e Anup Patel 2026-05-26 79
d715c82481af6e Anup Patel 2026-05-26 80 int sbi_mpxy_get_channel_ids(u32 channel_count, u32 *channel_ids)
d715c82481af6e Anup Patel 2026-05-26 81 {
d715c82481af6e Anup Patel 2026-05-26 82 struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
d715c82481af6e Anup Patel 2026-05-26 83 struct sbi_mpxy_channel_ids_data *sdata = mpxy->shmem;
d715c82481af6e Anup Patel 2026-05-26 84 u32 remaining, returned, count, start_index = 0;
d715c82481af6e Anup Patel 2026-05-26 85 struct sbiret sret;
d715c82481af6e Anup Patel 2026-05-26 86
d715c82481af6e Anup Patel 2026-05-26 87 if (!mpxy->shmem_active)
d715c82481af6e Anup Patel 2026-05-26 88 return -ENODEV;
d715c82481af6e Anup Patel 2026-05-26 89 if (!channel_count || !channel_ids)
d715c82481af6e Anup Patel 2026-05-26 90 return -EINVAL;
d715c82481af6e Anup Patel 2026-05-26 91
d715c82481af6e Anup Patel 2026-05-26 92 get_cpu();
d715c82481af6e Anup Patel 2026-05-26 93
d715c82481af6e Anup Patel 2026-05-26 94 do {
d715c82481af6e Anup Patel 2026-05-26 95 sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_GET_CHANNEL_IDS,
d715c82481af6e Anup Patel 2026-05-26 96 start_index, 0, 0, 0, 0, 0);
d715c82481af6e Anup Patel 2026-05-26 97 if (sret.error)
d715c82481af6e Anup Patel 2026-05-26 98 goto err_put_cpu;
d715c82481af6e Anup Patel 2026-05-26 99
d715c82481af6e Anup Patel 2026-05-26 100 remaining = le32_to_cpu(sdata->remaining);
d715c82481af6e Anup Patel 2026-05-26 101 returned = le32_to_cpu(sdata->returned);
d715c82481af6e Anup Patel 2026-05-26 102
d715c82481af6e Anup Patel 2026-05-26 @103 count = returned < (channel_count - start_index) ?
d715c82481af6e Anup Patel 2026-05-26 104 returned : (channel_count - start_index);
d715c82481af6e Anup Patel 2026-05-26 105 memcpy_from_le32(&channel_ids[start_index], sdata->channel_array, count);
d715c82481af6e Anup Patel 2026-05-26 106 start_index += count;
d715c82481af6e Anup Patel 2026-05-26 107 } while (remaining && start_index < channel_count);
d715c82481af6e Anup Patel 2026-05-26 108
d715c82481af6e Anup Patel 2026-05-26 109 err_put_cpu:
d715c82481af6e Anup Patel 2026-05-26 110 put_cpu();
d715c82481af6e Anup Patel 2026-05-26 111 return sbi_err_map_linux_errno(sret.error);
d715c82481af6e Anup Patel 2026-05-26 112 }
d715c82481af6e Anup Patel 2026-05-26 113 EXPORT_SYMBOL_GPL(sbi_mpxy_get_channel_ids);
d715c82481af6e Anup Patel 2026-05-26 114--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki