> -----Original Message----- > From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > Sent: Thursday, August 11, 2022 5:48 AM > To: Frank Li <frank.li@xxxxxxx> > Cc: linux-pci@xxxxxxxxxxxxxxx > Subject: [EXT] [bug report] PCI: endpoint: Support NTB transfer between RC > and EP > > Caution: EXT Email > > Hello Frank Li, > > The patch e35f56bb0330: "PCI: endpoint: Support NTB transfer between > RC and EP" from Feb 22, 2022, leads to the following Smatch static > checker warning: [Frank Li] Thanks, I think my MSI patch is under review. I will squash fixed Patch at next version. > > drivers/pci/endpoint/functions/pci-epf-vntb.c:560 epf_ntb_db_bar_init() > error: uninitialized symbol 'align'. > > drivers/pci/endpoint/functions/pci-epf-vntb.c > 539 static int epf_ntb_db_bar_init(struct epf_ntb *ntb) > 540 { > 541 const struct pci_epc_features *epc_features; > 542 u32 align; > ^^^^^ > 543 struct device *dev = &ntb->epf->dev; > 544 int ret; > 545 struct pci_epf_bar *epf_bar; > 546 void __iomem *mw_addr = NULL; > 547 enum pci_barno barno; > 548 size_t size; > 549 > 550 epc_features = pci_epc_get_features(ntb->epf->epc, > 551 ntb->epf->func_no, > 552 ntb->epf->vfunc_no); > 553 > 554 size = epf_ntb_db_size(ntb); > 555 > 556 barno = ntb->epf_ntb_bar[BAR_DB]; > 557 epf_bar = &ntb->epf->bar[barno]; > 558 > 559 if (!ntb->epf_db_phy) { > --> 560 mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, > 0); > ^^^^^ > Never initialized. > > 561 if (!mw_addr) { > 562 dev_err(dev, "Failed to allocate OB address\n"); > 563 return -ENOMEM; > 564 } > 565 } else { > 566 epf_bar->phys_addr = ntb->epf_db_phy; > 567 epf_bar->barno = barno; > 568 epf_bar->size = size; > 569 } > 570 > 571 ntb->epf_db = mw_addr; > 572 > 573 ret = pci_epc_set_bar(ntb->epf->epc, ntb->epf->func_no, ntb- > >epf->vfunc_no, epf_bar); > 574 if (ret) { > 575 dev_err(dev, "Doorbell BAR set failed\n"); > 576 goto err_alloc_peer_mem; > 577 } > 578 return ret; > 579 > 580 err_alloc_peer_mem: > 581 pci_epc_mem_free_addr(ntb->epf->epc, epf_bar->phys_addr, > mw_addr, epf_bar->size); > 582 return -1; > 583 } > > regards, > dan carpenter