drivers/platform/mellanox/mlxbf-tmfifo.c:275:38: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Wed Apr 03 2024 - 15:41:22 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c85af715cac0a951eea97393378e84bb49384734
commit: 78034cbece79c2d730ad0770b3b7f23eedbbecf5 platform/mellanox: mlxbf-tmfifo: Drop the Rx packet if no more descriptors
date: 7 months ago
config: arm64-randconfig-r112-20240404 (https://download.01.org/0day-ci/archive/20240404/202404040339.S7CUIgf3-lkp@xxxxxxxxx/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 546dc2245ffc4cccd0b05b58b7a5955e355a3b27)
reproduce: (https://download.01.org/0day-ci/archive/20240404/202404040339.S7CUIgf3-lkp@xxxxxxxxx/reproduce)

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/202404040339.S7CUIgf3-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/platform/mellanox/mlxbf-tmfifo.c:275:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __virtio32 [usertype] len @@ got unsigned long @@
drivers/platform/mellanox/mlxbf-tmfifo.c:275:38: sparse: expected restricted __virtio32 [usertype] len
drivers/platform/mellanox/mlxbf-tmfifo.c:275:38: sparse: got unsigned long

vim +275 drivers/platform/mellanox/mlxbf-tmfifo.c

257
258 /* Allocate vrings for the FIFO. */
259 static int mlxbf_tmfifo_alloc_vrings(struct mlxbf_tmfifo *fifo,
260 struct mlxbf_tmfifo_vdev *tm_vdev)
261 {
262 struct mlxbf_tmfifo_vring *vring;
263 struct device *dev;
264 dma_addr_t dma;
265 int i, size;
266 void *va;
267
268 for (i = 0; i < ARRAY_SIZE(tm_vdev->vrings); i++) {
269 vring = &tm_vdev->vrings[i];
270 vring->fifo = fifo;
271 vring->num = MLXBF_TMFIFO_VRING_SIZE;
272 vring->align = SMP_CACHE_BYTES;
273 vring->index = i;
274 vring->vdev_id = tm_vdev->vdev.id.device;
> 275 vring->drop_desc.len = VRING_DROP_DESC_MAX_LEN;
276 dev = &tm_vdev->vdev.dev;
277
278 size = vring_size(vring->num, vring->align);
279 va = dma_alloc_coherent(dev->parent, size, &dma, GFP_KERNEL);
280 if (!va) {
281 mlxbf_tmfifo_free_vrings(fifo, tm_vdev);
282 dev_err(dev->parent, "dma_alloc_coherent failed\n");
283 return -ENOMEM;
284 }
285
286 vring->va = va;
287 vring->dma = dma;
288 }
289
290 return 0;
291 }
292

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