Skip to content

Commit

Permalink
PCI: cadence: Fix DMA range mapping early return error
Browse files Browse the repository at this point in the history
Function cdns_pcie_host_map_dma_ranges() iterates over a PCIe host bridge
DMA ranges using the resource_list_for_each_entry() iterator, returning an
error if cdns_pcie_host_bar_config() fails.

49e427e ("Merge branch 'pci/host-probe-refactor'") botched a merge so
it *always* returned after the first DMA range, even if no error occurred.

Fix the error checking so we return early only when an error occurs.

[bhelgaas: commit log]
Fixes: 49e427e ("Merge branch 'pci/host-probe-refactor'")
Link: https://lore.kernel.org/r/20210216205935.3112661-1-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
kwilczynski authored and bjorn-helgaas committed Feb 18, 2021
1 parent 7c53f6b commit 1002573
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/pci/controller/cadence/pcie-cadence-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,10 @@ static int cdns_pcie_host_map_dma_ranges(struct cdns_pcie_rc *rc)

resource_list_for_each_entry(entry, &bridge->dma_ranges) {
err = cdns_pcie_host_bar_config(rc, entry);
if (err)
if (err) {
dev_err(dev, "Fail to configure IB using dma-ranges\n");
return err;
return err;
}
}

return 0;
Expand Down

0 comments on commit 1002573

Please sign in to comment.