Re: [PATCH v9 2/2] mtd: rawnand: Add Loongson-1 NAND Controller Driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Keguang,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 62f92d634458a1e308bb699986b9147a6d670457]

url:    https://github.com/intel-lab-lkp/linux/commits/Keguang-Zhang-via-B4-Relay/dt-bindings-mtd-Add-Loongson-1-NAND-Controller/20240920-191936
base:   62f92d634458a1e308bb699986b9147a6d670457
patch link:    https://lore.kernel.org/r/20240920-loongson1-nand-v9-2-9cc7b9345a03%40gmail.com
patch subject: [PATCH v9 2/2] mtd: rawnand: Add Loongson-1 NAND Controller Driver
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240921/202409212350.WrZuWTUv-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240921/202409212350.WrZuWTUv-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/202409212350.WrZuWTUv-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:15,
                    from drivers/mtd/nand/raw/loongson1_nand.c:8:
   drivers/mtd/nand/raw/loongson1_nand.c: In function 'ls1x_nand_dma_transfer':
>> drivers/mtd/nand/raw/loongson1_nand.c:349:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     349 |         if (IS_ALIGNED((u32)op->buf, chip->buf_align) &&
         |                        ^
   include/linux/align.h:13:44: note: in definition of macro 'IS_ALIGNED'
      13 | #define IS_ALIGNED(x, a)                (((x) & ((typeof(x))(a) - 1)) == 0)
         |                                            ^
>> drivers/mtd/nand/raw/loongson1_nand.c:349:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     349 |         if (IS_ALIGNED((u32)op->buf, chip->buf_align) &&
         |                        ^
   include/linux/align.h:13:58: note: in definition of macro 'IS_ALIGNED'
      13 | #define IS_ALIGNED(x, a)                (((x) & ((typeof(x))(a) - 1)) == 0)
         |                                                          ^

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for OMAP2PLUS_MBOX
   Depends on [n]: MAILBOX [=y] && (ARCH_OMAP2PLUS || ARCH_K3)
   Selected by [m]:
   - TI_K3_M4_REMOTEPROC [=m] && REMOTEPROC [=y] && (ARCH_K3 || COMPILE_TEST [=y])


vim +349 drivers/mtd/nand/raw/loongson1_nand.c

   333	
   334	static int ls1x_nand_dma_transfer(struct ls1x_nfc *nfc,
   335					  struct ls1x_nfc_op *op)
   336	{
   337		struct nand_chip *chip = &nfc->chip;
   338		struct dma_chan *chan = nfc->dma_chan;
   339		struct device *dev = chan->device->dev;
   340		struct dma_async_tx_descriptor *desc;
   341		enum dma_data_direction data_dir =
   342		    op->is_write ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
   343		enum dma_transfer_direction xfer_dir =
   344		    op->is_write ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
   345		char *dma_buf = NULL;
   346		dma_addr_t dma_addr;
   347		int ret;
   348	
 > 349		if (IS_ALIGNED((u32)op->buf, chip->buf_align) &&
   350		    IS_ALIGNED(op->len, chip->buf_align)) {
   351			dma_addr = dma_map_single(dev, op->buf, op->len, data_dir);
   352			if (dma_mapping_error(dev, dma_addr)) {
   353				dev_err(dev, "failed to map DMA buffer\n");
   354				return -ENXIO;
   355			}
   356		} else if (!op->is_write) {
   357			dma_buf = dma_alloc_coherent(dev, op->dma_len, &dma_addr,
   358						     GFP_KERNEL);
   359			if (!dma_buf)
   360				return -ENOMEM;
   361		} else {
   362			dev_err(dev, "subpage writing not supported\n");
   363			return -EOPNOTSUPP;
   364		}
   365	
   366		desc = dmaengine_prep_slave_single(chan, dma_addr, op->dma_len,
   367						   xfer_dir, DMA_PREP_INTERRUPT);
   368		if (!desc) {
   369			dev_err(dev, "failed to prepare DMA descriptor\n");
   370			ret = PTR_ERR(desc);
   371			goto err;
   372		}
   373		desc->callback = ls1x_nand_dma_callback;
   374		desc->callback_param = nfc;
   375	
   376		nfc->dma_cookie = dmaengine_submit(desc);
   377		ret = dma_submit_error(nfc->dma_cookie);
   378		if (ret) {
   379			dev_err(dev, "failed to submit DMA descriptor\n");
   380			goto err;
   381		}
   382	
   383		dev_dbg(dev, "issue DMA with cookie=%d\n", nfc->dma_cookie);
   384		dma_async_issue_pending(chan);
   385	
   386		ret = wait_for_completion_timeout(&nfc->dma_complete,
   387						  msecs_to_jiffies(2000));
   388		if (!ret) {
   389			dmaengine_terminate_sync(chan);
   390			reinit_completion(&nfc->dma_complete);
   391			ret = -ETIMEDOUT;
   392			goto err;
   393		}
   394		ret = 0;
   395	
   396		if (dma_buf)
   397			memcpy(op->buf, dma_buf + op->aligned_offset, op->len);
   398	err:
   399		if (dma_buf)
   400			dma_free_coherent(dev, op->dma_len, dma_buf, dma_addr);
   401		else
   402			dma_unmap_single(dev, dma_addr, op->len, data_dir);
   403	
   404		return ret;
   405	}
   406	

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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux