All of lore.kernel.org
 help / color / mirror / Atom feed
* [cip:linux-4.4.y-st-rc 1077/2707] drivers/spi/spi-fsl-cpm.c:137:17: warning: comparison between signed and unsigned integer expressions
@ 2024-10-03 17:02 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-10-03 17:02 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: oe-kbuild-all

Hi Christophe,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip.git linux-4.4.y-st-rc
head:   aea4aaf86b7212944b7bf66d6becb8c7bb51093e
commit: 8cfd8c7919b40a5c5c5646f4eefaa8b46090b610 [1077/2707] spi: fsl-cpm: Use 16 bit mode for large transfers with even size
config: powerpc-randconfig-003-20241003 (https://download.01.org/0day-ci/archive/20241004/202410040044.rcbPKuWD-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/202410040044.rcbPKuWD-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/202410040044.rcbPKuWD-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/scatterlist.h:7:0,
                    from include/linux/dma-mapping.h:10,
                    from drivers/spi/spi-fsl-cpm.c:20:
   include/linux/mm.h: In function 'is_vmalloc_addr':
   include/linux/mm.h:386:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     return addr >= VMALLOC_START && addr < VMALLOC_END;
                 ^~
   drivers/spi/spi-fsl-cpm.c: In function 'fsl_spi_cpm_bufs':
>> drivers/spi/spi-fsl-cpm.c:137:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for (i = 0; i < t->len >> 1; i++)
                    ^
   drivers/spi/spi-fsl-cpm.c: In function 'fsl_spi_cpm_bufs_complete':
   drivers/spi/spi-fsl-cpm.c:200:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for (i = 0; i < t->len; i += 2)
                    ^


vim +137 drivers/spi/spi-fsl-cpm.c

   104	
   105	int fsl_spi_cpm_bufs(struct mpc8xxx_spi *mspi,
   106			     struct spi_transfer *t, bool is_dma_mapped)
   107	{
   108		struct device *dev = mspi->dev;
   109		struct fsl_spi_reg *reg_base = mspi->reg_base;
   110	
   111		if (is_dma_mapped) {
   112			mspi->map_tx_dma = 0;
   113			mspi->map_rx_dma = 0;
   114		} else {
   115			mspi->map_tx_dma = 1;
   116			mspi->map_rx_dma = 1;
   117		}
   118	
   119		if (!t->tx_buf) {
   120			mspi->tx_dma = mspi->dma_dummy_tx;
   121			mspi->map_tx_dma = 0;
   122		}
   123	
   124		if (!t->rx_buf) {
   125			mspi->rx_dma = mspi->dma_dummy_rx;
   126			mspi->map_rx_dma = 0;
   127		}
   128		if (t->bits_per_word == 16 && t->tx_buf) {
   129			const u16 *src = t->tx_buf;
   130			u16 *dst;
   131			int i;
   132	
   133			dst = kmalloc(t->len, GFP_KERNEL);
   134			if (!dst)
   135				return -ENOMEM;
   136	
 > 137			for (i = 0; i < t->len >> 1; i++)
   138				dst[i] = cpu_to_le16p(src + i);
   139	
   140			mspi->tx = dst;
   141			mspi->map_tx_dma = 1;
   142		}
   143	
   144		if (mspi->map_tx_dma) {
   145			void *nonconst_tx = (void *)mspi->tx; /* shut up gcc */
   146	
   147			mspi->tx_dma = dma_map_single(dev, nonconst_tx, t->len,
   148						      DMA_TO_DEVICE);
   149			if (dma_mapping_error(dev, mspi->tx_dma)) {
   150				dev_err(dev, "unable to map tx dma\n");
   151				return -ENOMEM;
   152			}
   153		} else if (t->tx_buf) {
   154			mspi->tx_dma = t->tx_dma;
   155		}
   156	
   157		if (mspi->map_rx_dma) {
   158			mspi->rx_dma = dma_map_single(dev, mspi->rx, t->len,
   159						      DMA_FROM_DEVICE);
   160			if (dma_mapping_error(dev, mspi->rx_dma)) {
   161				dev_err(dev, "unable to map rx dma\n");
   162				goto err_rx_dma;
   163			}
   164		} else if (t->rx_buf) {
   165			mspi->rx_dma = t->rx_dma;
   166		}
   167	
   168		/* enable rx ints */
   169		mpc8xxx_spi_write_reg(&reg_base->mask, SPIE_RXB);
   170	
   171		mspi->xfer_in_progress = t;
   172		mspi->count = t->len;
   173	
   174		/* start CPM transfers */
   175		fsl_spi_cpm_bufs_start(mspi);
   176	
   177		return 0;
   178	
   179	err_rx_dma:
   180		if (mspi->map_tx_dma)
   181			dma_unmap_single(dev, mspi->tx_dma, t->len, DMA_TO_DEVICE);
   182		return -ENOMEM;
   183	}
   184	EXPORT_SYMBOL_GPL(fsl_spi_cpm_bufs);
   185	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-03 17:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-03 17:02 [cip:linux-4.4.y-st-rc 1077/2707] drivers/spi/spi-fsl-cpm.c:137:17: warning: comparison between signed and unsigned integer expressions kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.