Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-spi@vger.kernel.org,
	Mark Brown <broonie@kernel.org>
Subject: 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?
Date: Wed, 18 Nov 2026 00:08:51 +0800	[thread overview]
Message-ID: <avx8E8akqQw5ByZJ@xhacker> (raw)
In-Reply-To: <202611170617.CCFgmq6H-lkp@intel.com>

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

      reply	other threads:[~2026-11-17 16:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avx8E8akqQw5ByZJ@xhacker \
    --to=jszhang@kernel.org \
    --cc=broonie@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox