[PATCH v9 2/2] mtd: rawnand: Add Loongson-1 NAND Controller Driver
kernel test robot
lkp at intel.com
Sat Sep 21 09:45:55 PDT 2024
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: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240922/202409220010.vctkHddZ-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240922/202409220010.vctkHddZ-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409220010.vctkHddZ-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/mtd/nand/raw/loongson1_nand.c:349:17: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'char *' [-Wpointer-to-int-cast]
349 | if (IS_ALIGNED((u32)op->buf, chip->buf_align) &&
| ^~~~~~~~~~~~
include/linux/align.h:13:30: note: expanded from macro 'IS_ALIGNED'
13 | #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
| ^
>> drivers/mtd/nand/raw/loongson1_nand.c:349:17: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'char *' [-Wpointer-to-int-cast]
349 | if (IS_ALIGNED((u32)op->buf, chip->buf_align) &&
| ^~~~~~~~~~~~
include/linux/align.h:13:44: note: expanded from macro 'IS_ALIGNED'
13 | #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
| ^
2 warnings generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for OMAP2PLUS_MBOX
Depends on [n]: MAILBOX [=y] && (ARCH_OMAP2PLUS || ARCH_K3)
Selected by [y]:
- TI_K3_M4_REMOTEPROC [=y] && 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
More information about the linux-mtd
mailing list