public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: <dan.carpenter@oracle.com>
To: kishon@ti.com
Cc: linux-pci@vger.kernel.org
Subject: [bug report] PCI: cadence: Use "dma-ranges" instead of "cdns,no-bar-match-nbits" property
Date: Mon, 27 Jul 2020 14:19:43 +0300	[thread overview]
Message-ID: <20200727111943.GD389488@mwanda> (raw)

Hello Kishon Vijay Abraham I,

The patch 82d8567259b1: "PCI: cadence: Use "dma-ranges" instead of
"cdns,no-bar-match-nbits" property" from Jul 22, 2020, leads to the
following static checker warning:

	drivers/pci/controller/cadence/pcie-cadence-host.c:322 cdns_pcie_host_map_dma_ranges()
	warn: ignoring unreachable code.

drivers/pci/controller/cadence/pcie-cadence-host.c
   296  static int cdns_pcie_host_map_dma_ranges(struct cdns_pcie_rc *rc)
   297  {
   298          struct cdns_pcie *pcie = &rc->pcie;
   299          struct device *dev = pcie->dev;
   300          struct device_node *np = dev->of_node;
   301          struct pci_host_bridge *bridge;
   302          struct resource_entry *entry;
   303          u32 no_bar_nbits = 32;
   304          int err;
   305  
   306          bridge = pci_host_bridge_from_priv(rc);
   307          if (!bridge)
   308                  return -ENOMEM;
   309  
   310          if (list_empty(&bridge->dma_ranges)) {
   311                  of_property_read_u32(np, "cdns,no-bar-match-nbits",
   312                                       &no_bar_nbits);
   313                  err = cdns_pcie_host_bar_ib_config(rc, RP_NO_BAR, 0x0,
   314                                                     (u64)1 << no_bar_nbits, 0);
   315                  if (err)
   316                          dev_err(dev, "IB BAR: %d config failed\n", RP_NO_BAR);
   317                  return err;
   318          }
   319  
   320          list_sort(NULL, &bridge->dma_ranges, cdns_pcie_host_dma_ranges_cmp);
   321  
   322          resource_list_for_each_entry(entry, &bridge->dma_ranges) {

That static checker is complaining that we only use the first entry in
the list.  This is often intentional so I have normally just silence
these..

   323                  err = cdns_pcie_host_bar_config(rc, entry);
   324                  if (err)
   325                          dev_err(dev, "Fail to configure IB using dma-ranges\n");
   326                  return err;

But in this case, it's possible that it wasn't intentional.  Anyway, I
figure you know the answer instantly since the code is new so hopefully
it's not too much bother.

   327          }
   328  
   329          return 0;
   330  }

regards,
dan carpenter

                 reply	other threads:[~2020-07-27 11:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200727111943.GD389488@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kishon@ti.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