[bug report] PCI: cadence: Use "dma-ranges" instead of "cdns,no-bar-match-nbits" property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux