* [bug report] PCI: endpoint: Support NTB transfer between RC and EP
@ 2022-08-11 10:47 Dan Carpenter
2022-08-12 17:58 ` [EXT] " Frank Li
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-08-11 10:47 UTC (permalink / raw)
To: Frank.Li; +Cc: linux-pci
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:
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [EXT] [bug report] PCI: endpoint: Support NTB transfer between RC and EP
2022-08-11 10:47 [bug report] PCI: endpoint: Support NTB transfer between RC and EP Dan Carpenter
@ 2022-08-12 17:58 ` Frank Li
0 siblings, 0 replies; 2+ messages in thread
From: Frank Li @ 2022-08-12 17:58 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-pci@vger.kernel.org
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Thursday, August 11, 2022 5:48 AM
> To: Frank Li <frank.li@nxp.com>
> Cc: linux-pci@vger.kernel.org
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-12 17:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 10:47 [bug report] PCI: endpoint: Support NTB transfer between RC and EP Dan Carpenter
2022-08-12 17:58 ` [EXT] " Frank Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.