[jonmason-ntb:ntb-next-hacking 18/18] drivers/pci/endpoint/functions/pci-epf-vntb.c:560:56: warning: variable 'align' is uninitialized when used here

From: kernel test robot
Date: Sat Aug 13 2022 - 22:15:27 EST


tree: https://github.com/jonmason/ntb ntb-next-hacking
head: d90921d21692b59734d2452efea346217a526f44
commit: d90921d21692b59734d2452efea346217a526f44 [18/18] pcie: endpoint: pci-epf-vntb: add endpoint msi support
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20220814/202208141017.cwJ0JXde-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/jonmason/ntb/commit/d90921d21692b59734d2452efea346217a526f44
git remote add jonmason-ntb https://github.com/jonmason/ntb
git fetch --no-tags jonmason-ntb ntb-next-hacking
git checkout d90921d21692b59734d2452efea346217a526f44
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/pci/endpoint/functions/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/pci/endpoint/functions/pci-epf-vntb.c:541:33: warning: variable 'epc_features' set but not used [-Wunused-but-set-variable]
const struct pci_epc_features *epc_features;
^
>> drivers/pci/endpoint/functions/pci-epf-vntb.c:560:56: warning: variable 'align' is uninitialized when used here [-Wuninitialized]
mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, 0);
^~~~~
drivers/pci/endpoint/functions/pci-epf-vntb.c:542:11: note: initialize the variable 'align' to silence this warning
u32 align;
^
= 0
2 warnings generated.


vim +/align +560 drivers/pci/endpoint/functions/pci-epf-vntb.c

d90921d21692b59 Frank Li 2022-07-07 534
53efbaa43643f36 Frank Li 2022-02-22 535 /**
53efbaa43643f36 Frank Li 2022-02-22 536 * epf_ntb_db_bar_init() - Configure Doorbell window BARs
53efbaa43643f36 Frank Li 2022-02-22 537 * @ntb: NTB device that facilitates communication between HOST and vHOST
53efbaa43643f36 Frank Li 2022-02-22 538 */
53efbaa43643f36 Frank Li 2022-02-22 539 static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
53efbaa43643f36 Frank Li 2022-02-22 540 {
53efbaa43643f36 Frank Li 2022-02-22 541 const struct pci_epc_features *epc_features;
53efbaa43643f36 Frank Li 2022-02-22 542 u32 align;
53efbaa43643f36 Frank Li 2022-02-22 543 struct device *dev = &ntb->epf->dev;
53efbaa43643f36 Frank Li 2022-02-22 544 int ret;
53efbaa43643f36 Frank Li 2022-02-22 545 struct pci_epf_bar *epf_bar;
d90921d21692b59 Frank Li 2022-07-07 546 void __iomem *mw_addr = NULL;
53efbaa43643f36 Frank Li 2022-02-22 547 enum pci_barno barno;
d90921d21692b59 Frank Li 2022-07-07 548 size_t size;
53efbaa43643f36 Frank Li 2022-02-22 549
53efbaa43643f36 Frank Li 2022-02-22 550 epc_features = pci_epc_get_features(ntb->epf->epc,
53efbaa43643f36 Frank Li 2022-02-22 551 ntb->epf->func_no,
53efbaa43643f36 Frank Li 2022-02-22 552 ntb->epf->vfunc_no);
53efbaa43643f36 Frank Li 2022-02-22 553
d90921d21692b59 Frank Li 2022-07-07 554 size = epf_ntb_db_size(ntb);
53efbaa43643f36 Frank Li 2022-02-22 555
53efbaa43643f36 Frank Li 2022-02-22 556 barno = ntb->epf_ntb_bar[BAR_DB];
d90921d21692b59 Frank Li 2022-07-07 557 epf_bar = &ntb->epf->bar[barno];
53efbaa43643f36 Frank Li 2022-02-22 558
d90921d21692b59 Frank Li 2022-07-07 559 if (!ntb->epf_db_phy) {
53efbaa43643f36 Frank Li 2022-02-22 @560 mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, 0);
53efbaa43643f36 Frank Li 2022-02-22 561 if (!mw_addr) {
53efbaa43643f36 Frank Li 2022-02-22 562 dev_err(dev, "Failed to allocate OB address\n");
53efbaa43643f36 Frank Li 2022-02-22 563 return -ENOMEM;
53efbaa43643f36 Frank Li 2022-02-22 564 }
d90921d21692b59 Frank Li 2022-07-07 565 } else {
d90921d21692b59 Frank Li 2022-07-07 566 epf_bar->phys_addr = ntb->epf_db_phy;
d90921d21692b59 Frank Li 2022-07-07 567 epf_bar->barno = barno;
d90921d21692b59 Frank Li 2022-07-07 568 epf_bar->size = size;
d90921d21692b59 Frank Li 2022-07-07 569 }
53efbaa43643f36 Frank Li 2022-02-22 570
53efbaa43643f36 Frank Li 2022-02-22 571 ntb->epf_db = mw_addr;
53efbaa43643f36 Frank Li 2022-02-22 572
53efbaa43643f36 Frank Li 2022-02-22 573 ret = pci_epc_set_bar(ntb->epf->epc, ntb->epf->func_no, ntb->epf->vfunc_no, epf_bar);
53efbaa43643f36 Frank Li 2022-02-22 574 if (ret) {
53efbaa43643f36 Frank Li 2022-02-22 575 dev_err(dev, "Doorbell BAR set failed\n");
53efbaa43643f36 Frank Li 2022-02-22 576 goto err_alloc_peer_mem;
53efbaa43643f36 Frank Li 2022-02-22 577 }
53efbaa43643f36 Frank Li 2022-02-22 578 return ret;
53efbaa43643f36 Frank Li 2022-02-22 579
53efbaa43643f36 Frank Li 2022-02-22 580 err_alloc_peer_mem:
53efbaa43643f36 Frank Li 2022-02-22 581 pci_epc_mem_free_addr(ntb->epf->epc, epf_bar->phys_addr, mw_addr, epf_bar->size);
53efbaa43643f36 Frank Li 2022-02-22 582 return -1;
53efbaa43643f36 Frank Li 2022-02-22 583 }
53efbaa43643f36 Frank Li 2022-02-22 584

:::::: The code at line 560 was first introduced by commit
:::::: 53efbaa43643f36d203700e7f436eaac11695274 PCI: endpoint: Support NTB transfer between RC and EP

:::::: TO: Frank Li <Frank.Li@xxxxxxx>
:::::: CC: Jon Mason <jdmason@xxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp