Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: cadence: Fix DMA range mapping early return error

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.

49e427e6bdd1 ("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: 49e427e6bdd1 ("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>

authored by

Krzysztof Wilczyński and committed by
Bjorn Helgaas
1002573e 7c53f6b6

+3 -2
+3 -2
drivers/pci/controller/cadence/pcie-cadence-host.c
··· 321 321 322 322 resource_list_for_each_entry(entry, &bridge->dma_ranges) { 323 323 err = cdns_pcie_host_bar_config(rc, entry); 324 - if (err) 324 + if (err) { 325 325 dev_err(dev, "Fail to configure IB using dma-ranges\n"); 326 - return err; 326 + return err; 327 + } 327 328 } 328 329 329 330 return 0;