Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Frank.Li@nxp.com
Cc: linux-pci@vger.kernel.org
Subject: [bug report] PCI: endpoint: Support NTB transfer between RC and EP
Date: Thu, 11 Aug 2022 13:47:53 +0300	[thread overview]
Message-ID: <YvTeWal8mQg56xMA@kili> (raw)

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

             reply	other threads:[~2022-08-11 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 10:47 Dan Carpenter [this message]
2022-08-12 17:58 ` [EXT] [bug report] PCI: endpoint: Support NTB transfer between RC and EP Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YvTeWal8mQg56xMA@kili \
    --to=dan.carpenter@oracle.com \
    --cc=Frank.Li@nxp.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox