Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09b85794 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

nfp: don't set aux pointers if ioremap failed



If ioremap of PCIe ctrl memory failed we can still get to it through
PCI config space, therefore we allow ioremap() to fail.  When if fails,
however, we must leave all the IOMEM pointers as NULL.  Currently we
would calculate csr and em pointers, adding offsets to the potential
NULL value and therefore making the NULL-checks throughout the code
ineffective.

Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 651e1f2f
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -639,19 +639,23 @@ static int enable_bars(struct nfp6000_pcie *nfp, u16 interface)
		nfp6000_bar_write(nfp, bar, barcfg_msix_general);

		nfp->expl.data = bar->iomem + NFP_PCIE_SRAM + 0x1000;
	}

		if (nfp->pdev->device == PCI_DEVICE_ID_NETRONOME_NFP4000 ||
		    nfp->pdev->device == PCI_DEVICE_ID_NETRONOME_NFP6000) {
			nfp->iomem.csr = bar->iomem + NFP_PCIE_BAR(0);
		expl_groups = 4;
		} else {
			int pf = nfp->pdev->devfn & 7;

			nfp->iomem.csr = bar->iomem + NFP_PCIE_BAR(pf);
		expl_groups = 1;
		}
		nfp->iomem.em = bar->iomem + NFP_PCIE_EM;
	}

	if (nfp->pdev->device == PCI_DEVICE_ID_NETRONOME_NFP4000 ||
	    nfp->pdev->device == PCI_DEVICE_ID_NETRONOME_NFP6000)
		expl_groups = 4;
	else
		expl_groups = 1;

	/* Configure, and lock, BAR0.1 for PCIe XPB (MSI-X PBA) */
	bar = &nfp->bar[1];