* [broonie-spi:for-7.5 2/6] drivers/spi/spi-cadence-xspi.c:438:43: sparse: sparse: unsigned value that used to be signed checked against zero?
@ 2026-11-17 5:23 kernel test robot
2026-11-17 16:08 ` Jisheng Zhang
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-11-17 5:23 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: oe-kbuild-all, linux-spi, Mark Brown
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.5
head: 9b2d7c8736a6fd27ceda93bd67529758c139e24f
commit: b7d724ff0f4ab6b5d3392938076f5914ecec12fd [2/6] spi: cadence-xspi: Support dmaengine for sdma io copy
config: m68k-randconfig-r2308-20261117 (https://download.01.org/0day-ci/archive/20261117/202611170617.CCFgmq6H-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 10.5.0
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261117/202611170617.CCFgmq6H-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611170617.CCFgmq6H-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/spi/spi-cadence-xspi.c:438:43: sparse: sparse: unsigned value that used to be signed checked against zero?
drivers/spi/spi-cadence-xspi.c:430:59: sparse: signed value source
vim +438 drivers/spi/spi-cadence-xspi.c
422
423 /* -EAGAIN means no DMA was issued, so the caller can use the CPU path. */
424 static int cdns_xspi_dma_transfer(struct cdns_xspi_dev *cdns_xspi,
425 size_t len, bool read)
426 {
427 struct dma_chan *chan = cdns_xspi->dma_chan;
428 dma_addr_t port_addr = cdns_xspi->dma_addr;
429 enum dma_data_direction dir = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
430 void *buf = read ? cdns_xspi->in_buffer : (void *)cdns_xspi->out_buffer;
431 struct dma_async_tx_descriptor *desc;
432 struct device *dma_dev;
433 dma_addr_t buf_addr;
434 dma_cookie_t cookie;
435 int ret = -EAGAIN;
436
437 if (!chan || len < cdns_xspi->dma_data_width ||
> 438 len > cdns_xspi->sdmasize || !virt_addr_valid(buf))
439 return -EAGAIN;
440
441 dma_dev = dmaengine_get_dma_device(chan);
442 buf_addr = dma_map_single(dma_dev, buf, len, dir);
443 if (dma_mapping_error(dma_dev, buf_addr))
444 return -EAGAIN;
445 if (!is_dma_copy_aligned(chan->device, port_addr, buf_addr, len))
446 goto unmap;
447
448 desc = dmaengine_prep_dma_memcpy(chan, read ? buf_addr : port_addr,
449 read ? port_addr : buf_addr, len,
450 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
451 if (!desc)
452 goto unmap;
453
454 reinit_completion(&cdns_xspi->dma_complete);
455 cdns_xspi->dma_error = false;
456 desc->callback_result = cdns_xspi_dma_callback;
457 desc->callback_param = cdns_xspi;
458 cookie = dmaengine_submit(desc);
459 if (dma_submit_error(cookie)) {
460 dmaengine_terminate_sync(chan);
461 goto unmap;
462 }
463 dma_async_issue_pending(chan);
464
465 if (!wait_for_completion_timeout(&cdns_xspi->dma_complete,
466 msecs_to_jiffies(CDNS_XSPI_DMA_TIMEOUT_MS))) {
467 dmaengine_terminate_sync(chan);
468 dev_err(cdns_xspi->dev, "SDMA %s DMA timeout\n", read ? "read" : "write");
469 ret = -ETIMEDOUT;
470 } else if (cdns_xspi->dma_error) {
471 dmaengine_terminate_sync(chan);
472 ret = -EIO;
473 } else {
474 ret = 0;
475 }
476
477 unmap:
478 dma_unmap_single(dma_dev, buf_addr, len, dir);
479 return ret;
480 }
481
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [broonie-spi:for-7.5 2/6] drivers/spi/spi-cadence-xspi.c:438:43: sparse: sparse: unsigned value that used to be signed checked against zero?
2026-11-17 5:23 [broonie-spi:for-7.5 2/6] drivers/spi/spi-cadence-xspi.c:438:43: sparse: sparse: unsigned value that used to be signed checked against zero? kernel test robot
@ 2026-11-17 16:08 ` Jisheng Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Jisheng Zhang @ 2026-11-17 16:08 UTC (permalink / raw)
To: kernel test robot; +Cc: oe-kbuild-all, linux-spi, Mark Brown
On Tue, Nov 17, 2026 at 06:23:56AM +0100, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.5
> head: 9b2d7c8736a6fd27ceda93bd67529758c139e24f
> commit: b7d724ff0f4ab6b5d3392938076f5914ecec12fd [2/6] spi: cadence-xspi: Support dmaengine for sdma io copy
> config: m68k-randconfig-r2308-20261117 (https://download.01.org/0day-ci/archive/20261117/202611170617.CCFgmq6H-lkp@intel.com/config)
This is NOMMU.
> compiler: m68k-linux-gcc (GCC) 10.5.0
> sparse: v0.6.5-rc1-21-g84ec0658
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261117/202611170617.CCFgmq6H-lkp@intel.com/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@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202611170617.CCFgmq6H-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
> >> drivers/spi/spi-cadence-xspi.c:438:43: sparse: sparse: unsigned value that used to be signed checked against zero?
> drivers/spi/spi-cadence-xspi.c:430:59: sparse: signed value source
All virt_addr_valid() users have the same issue, for example, I can
reproduce the same sparse warning with exsiting cadence qspi driver + arm nommu
The correct fix should be fixing the arch nommu code. But I doubt patching
nommu arch code deserves the effort.
>
> vim +438 drivers/spi/spi-cadence-xspi.c
>
> 422
> 423 /* -EAGAIN means no DMA was issued, so the caller can use the CPU path. */
> 424 static int cdns_xspi_dma_transfer(struct cdns_xspi_dev *cdns_xspi,
> 425 size_t len, bool read)
> 426 {
> 427 struct dma_chan *chan = cdns_xspi->dma_chan;
> 428 dma_addr_t port_addr = cdns_xspi->dma_addr;
> 429 enum dma_data_direction dir = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
> 430 void *buf = read ? cdns_xspi->in_buffer : (void *)cdns_xspi->out_buffer;
> 431 struct dma_async_tx_descriptor *desc;
> 432 struct device *dma_dev;
> 433 dma_addr_t buf_addr;
> 434 dma_cookie_t cookie;
> 435 int ret = -EAGAIN;
> 436
> 437 if (!chan || len < cdns_xspi->dma_data_width ||
> > 438 len > cdns_xspi->sdmasize || !virt_addr_valid(buf))
> 439 return -EAGAIN;
> 440
> 441 dma_dev = dmaengine_get_dma_device(chan);
> 442 buf_addr = dma_map_single(dma_dev, buf, len, dir);
> 443 if (dma_mapping_error(dma_dev, buf_addr))
> 444 return -EAGAIN;
> 445 if (!is_dma_copy_aligned(chan->device, port_addr, buf_addr, len))
> 446 goto unmap;
> 447
> 448 desc = dmaengine_prep_dma_memcpy(chan, read ? buf_addr : port_addr,
> 449 read ? port_addr : buf_addr, len,
> 450 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> 451 if (!desc)
> 452 goto unmap;
> 453
> 454 reinit_completion(&cdns_xspi->dma_complete);
> 455 cdns_xspi->dma_error = false;
> 456 desc->callback_result = cdns_xspi_dma_callback;
> 457 desc->callback_param = cdns_xspi;
> 458 cookie = dmaengine_submit(desc);
> 459 if (dma_submit_error(cookie)) {
> 460 dmaengine_terminate_sync(chan);
> 461 goto unmap;
> 462 }
> 463 dma_async_issue_pending(chan);
> 464
> 465 if (!wait_for_completion_timeout(&cdns_xspi->dma_complete,
> 466 msecs_to_jiffies(CDNS_XSPI_DMA_TIMEOUT_MS))) {
> 467 dmaengine_terminate_sync(chan);
> 468 dev_err(cdns_xspi->dev, "SDMA %s DMA timeout\n", read ? "read" : "write");
> 469 ret = -ETIMEDOUT;
> 470 } else if (cdns_xspi->dma_error) {
> 471 dmaengine_terminate_sync(chan);
> 472 ret = -EIO;
> 473 } else {
> 474 ret = 0;
> 475 }
> 476
> 477 unmap:
> 478 dma_unmap_single(dma_dev, buf_addr, len, dir);
> 479 return ret;
> 480 }
> 481
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-17 16:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 5:23 [broonie-spi:for-7.5 2/6] drivers/spi/spi-cadence-xspi.c:438:43: sparse: sparse: unsigned value that used to be signed checked against zero? kernel test robot
2026-11-17 16:08 ` Jisheng Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox