Re: [PATCH 6/8] nvmet: pci-epf: Use dmaengine_prep_slave_single_config() API

kernel test robot
2025-12-10T19:06:05Z

Hi Frank,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bc04acf4aeca588496124a6cf54bfce3db327039]

url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/dmaengine-Add-API-to-combine-configuration-and-preparation-sg-and-single/20251209-011820
base: bc04acf4aeca588496124a6cf54bfce3db327039
patch link: https://lore.kernel.org/r/20251208-dma_prep_config-v1-6-53490c5e1e2a%40nxp.com
patch subject: [PATCH 6/8] nvmet: pci-epf: Use dmaengine_prep_slave_single_config() API
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20251211/202512110249.kCiMC4sb-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251211/202512110249.kCiMC4sb-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/202512110249.kCiMC4sb-lkp@intel.com/

All warnings (new ones prefixed by >>):

drivers/nvme/target/pci-epf.c: In function 'nvmet_pci_epf_dma_transfer':
>> drivers/nvme/target/pci-epf.c:369:23: warning: variable 'lock' set but not used [-Wunused-but-set-variable]
369 | struct mutex *lock;
| ^~~~

vim +/lock +369 drivers/nvme/target/pci-epf.c

0faa0fe6f90ea5 Damien Le Moal 2025-01-04 357
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 358 static int nvmet_pci_epf_dma_transfer(struct nvmet_pci_epf *nvme_epf,
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 359 struct nvmet_pci_epf_segment *seg, enum dma_data_direction dir)
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 360 {
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 361 struct pci_epf *epf = nvme_epf->epf;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 362 struct dma_async_tx_descriptor *desc;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 363 struct dma_slave_config sconf = {};
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 364 struct device *dev = &epf->dev;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 365 struct device *dma_dev;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 366 struct dma_chan *chan;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 367 dma_cookie_t cookie;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 368 dma_addr_t dma_addr;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 @369 struct mutex *lock;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 370 int ret;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 371
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 372 switch (dir) {
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 373 case DMA_FROM_DEVICE:
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 374 lock = &nvme_epf->dma_rx_lock;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 375 chan = nvme_epf->dma_rx_chan;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 376 sconf.direction = DMA_DEV_TO_MEM;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 377 sconf.src_addr = seg->pci_addr;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 378 break;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 379 case DMA_TO_DEVICE:
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 380 lock = &nvme_epf->dma_tx_lock;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 381 chan = nvme_epf->dma_tx_chan;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 382 sconf.direction = DMA_MEM_TO_DEV;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 383 sconf.dst_addr = seg->pci_addr;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 384 break;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 385 default:
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 386 return -EINVAL;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 387 }
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 388
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 389 dma_dev = dmaengine_get_dma_device(chan);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 390 dma_addr = dma_map_single(dma_dev, seg->buf, seg->length, dir);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 391 ret = dma_mapping_error(dma_dev, dma_addr);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 392 if (ret)
f9f42a84df49d9 Frank Li 2025-12-08 393 return ret;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 394
f9f42a84df49d9 Frank Li 2025-12-08 395 desc = dmaengine_prep_slave_single_config(chan, dma_addr, seg->length,
f9f42a84df49d9 Frank Li 2025-12-08 396 sconf.direction,
f9f42a84df49d9 Frank Li 2025-12-08 397 DMA_CTRL_ACK,
f9f42a84df49d9 Frank Li 2025-12-08 398 &sconf);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 399 if (!desc) {
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 400 dev_err(dev, "Failed to prepare DMA\n");
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 401 ret = -EIO;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 402 goto unmap;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 403 }
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 404
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 405 cookie = dmaengine_submit(desc);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 406 ret = dma_submit_error(cookie);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 407 if (ret) {
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 408 dev_err(dev, "Failed to do DMA submit (err=%d)\n", ret);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 409 goto unmap;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 410 }
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 411
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 412 if (dma_sync_wait(chan, cookie) != DMA_COMPLETE) {
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 413 dev_err(dev, "DMA transfer failed\n");
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 414 ret = -EIO;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 415 }
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 416
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 417 unmap:
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 418 dma_unmap_single(dma_dev, dma_addr, seg->length, dir);
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 419
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 420 return ret;
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 421 }
0faa0fe6f90ea5 Damien Le Moal 2025-01-04 422

--
0-DAY CI Kernel Test Service