Re: [PATCH v4 1/1] dmaengine: switchtec-dma: Introduce Switchtec DMA engine PCI driver

From: kernel test robot
Date: Sun Apr 23 2023 - 21:36:48 EST


Hi Kelvin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on linus/master v6.3 next-20230421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Kelvin-Cao/dmaengine-switchtec-dma-Introduce-Switchtec-DMA-engine-PCI-driver/20230424-065123
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link: https://lore.kernel.org/r/20230423213717.318655-2-kelvin.cao%40microchip.com
patch subject: [PATCH v4 1/1] dmaengine: switchtec-dma: Introduce Switchtec DMA engine PCI driver
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20230424/202304240915.MYWRJpvn-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/bd3b335b60238af4f01bd6c28a96873988330557
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Kelvin-Cao/dmaengine-switchtec-dma-Introduce-Switchtec-DMA-engine-PCI-driver/20230424-065123
git checkout bd3b335b60238af4f01bd6c28a96873988330557
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/dma/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304240915.MYWRJpvn-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/dma/switchtec_dma.c: In function 'switchtec_dma_create':
>> drivers/dma/switchtec_dma.c:1410:13: warning: variable 'i' set but not used [-Wunused-but-set-variable]
1410 | int i;
| ^


vim +/i +1410 drivers/dma/switchtec_dma.c

1400
1401 static int switchtec_dma_create(struct pci_dev *pdev)
1402 {
1403 struct switchtec_dma_dev *swdma_dev;
1404 struct dma_device *dma;
1405 struct dma_chan *chan;
1406 int chan_cnt;
1407 int nr_vecs;
1408 int irq;
1409 int rc;
> 1410 int i;
1411
1412 /*
1413 * Create the switchtec dma device
1414 */
1415 swdma_dev = kzalloc(sizeof(*swdma_dev), GFP_KERNEL);
1416 if (!swdma_dev)
1417 return -ENOMEM;
1418
1419 swdma_dev->bar = ioremap(pci_resource_start(pdev, 0),
1420 pci_resource_len(pdev, 0));
1421
1422 pci_info(pdev, "Switchtec PSX/PFX DMA EP\n");
1423
1424 RCU_INIT_POINTER(swdma_dev->pdev, pdev);
1425
1426 nr_vecs = pci_msix_vec_count(pdev);
1427 rc = pci_alloc_irq_vectors(pdev, nr_vecs, nr_vecs, PCI_IRQ_MSIX);
1428 if (rc < 0)
1429 goto err_exit;
1430
1431 tasklet_init(&swdma_dev->chan_status_task,
1432 switchtec_dma_chan_status_task,
1433 (unsigned long)swdma_dev);
1434
1435 irq = readw(swdma_dev->bar + SWITCHTEC_REG_CHAN_STS_VEC);
1436 pci_dbg(pdev, "Channel pause irq vector %d\n", irq);
1437
1438 irq = pci_irq_vector(pdev, irq);
1439 if (irq < 0) {
1440 rc = irq;
1441 goto err_exit;
1442 }
1443
1444 rc = request_irq(irq, switchtec_dma_chan_status_isr, 0,
1445 KBUILD_MODNAME, swdma_dev);
1446 if (rc)
1447 goto err_exit;
1448
1449 swdma_dev->chan_status_irq = irq;
1450
1451 chan_cnt = readl(swdma_dev->bar + SWITCHTEC_REG_CHAN_CNT);
1452 if (!chan_cnt) {
1453 pci_err(pdev, "No channel configured.\n");
1454 rc = -ENXIO;
1455 goto err_exit;
1456 }
1457
1458 chan_cnt = switchtec_dma_chans_enumerate(swdma_dev, chan_cnt);
1459 if (chan_cnt < 0) {
1460 pci_err(pdev, "Failed to enumerate dma channels: %d\n",
1461 chan_cnt);
1462 rc = -ENXIO;
1463 goto err_exit;
1464 }
1465
1466 swdma_dev->chan_cnt = chan_cnt;
1467
1468 dma = &swdma_dev->dma_dev;
1469 dma->copy_align = DMAENGINE_ALIGN_1_BYTE;
1470 dma_cap_set(DMA_MEMCPY, dma->cap_mask);
1471 dma_cap_set(DMA_PRIVATE, dma->cap_mask);
1472 dma->dev = get_device(&pdev->dev);
1473
1474 dma->device_alloc_chan_resources = switchtec_dma_alloc_chan_resources;
1475 dma->device_free_chan_resources = switchtec_dma_free_chan_resources;
1476 dma->device_prep_dma_memcpy = switchtec_dma_prep_memcpy;
1477 dma->device_prep_dma_imm_data = switchtec_dma_prep_wimm_data;
1478 dma->device_issue_pending = switchtec_dma_issue_pending;
1479 dma->device_tx_status = switchtec_dma_tx_status;
1480 dma->device_pause = switchtec_dma_pause;
1481 dma->device_resume = switchtec_dma_resume;
1482 dma->device_terminate_all = switchtec_dma_terminate_all;
1483 dma->device_synchronize = switchtec_dma_synchronize;
1484 dma->device_release = switchtec_dma_release;
1485
1486 rc = dma_async_device_register(dma);
1487 if (rc) {
1488 pci_err(pdev, "Failed to register dma device: %d\n", rc);
1489 goto err_chans_release_exit;
1490 }
1491
1492 pci_info(pdev, "Channel count: %d\n", chan_cnt);
1493
1494 i = 0;
1495 list_for_each_entry(chan, &dma->channels, device_node)
1496 pci_info(pdev, "%s\n", dma_chan_name(chan));
1497
1498 pci_set_drvdata(pdev, swdma_dev);
1499
1500 return 0;
1501
1502 err_chans_release_exit:
1503 switchtec_dma_chans_release(swdma_dev);
1504
1505 err_exit:
1506 if (swdma_dev->chan_status_irq)
1507 free_irq(swdma_dev->chan_status_irq, swdma_dev);
1508
1509 iounmap(swdma_dev->bar);
1510 kfree(swdma_dev);
1511 return rc;
1512 }
1513

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