From: "Krzysztof Wilczyński" <kw@linux.com>
To: Tom Joseph <tjoseph@cadence.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Rob Herring <robh@kernel.org>,
linux-pci@vger.kernel.org
Subject: [PATCH] PCI: cadence: Fix erroneous early return from an iterator
Date: Tue, 16 Feb 2021 20:59:35 +0000 [thread overview]
Message-ID: <20210216205935.3112661-1-kw@linux.com> (raw)
Function cdns_pcie_host_map_dma_ranges() iterates over a PCIe host
bridge DMA ranges using the resource_list_for_each_entry() iterator.
With every iteration it calls cdns_pcie_host_bar_config() on each entry
in the list, and performs error checking following execution of said
function.
Normally, should there be an error, the iteration would be interrupted
and the function would terminate returning an error, but following the
merge commit 49e427e6bdd1 ("Merge branch 'pci/host-probe-refactor'")
that also had to resolve a merge conflict of the pcie-cadence-host.c
file, where an if-statement involved in the error handling has been
unintentionally altered causing a return statement to be outside of the
code block, and thus an undesired early return takes place on first
iteration.
Fix the if-statement and move the return statement inside the correct
code block so that the error checking works correctly, and to prevent
undesired early return.
Fixes: 49e427e6bdd1 ("Merge branch 'pci/host-probe-refactor'")
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
drivers/pci/controller/cadence/pcie-cadence-host.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
index 811c1cb2e8de..1cb7cfc75d6e 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-host.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
@@ -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;
--
2.30.0
next reply other threads:[~2021-02-16 21:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-16 20:59 Krzysztof Wilczyński [this message]
2021-02-17 20:57 ` [PATCH] PCI: cadence: Fix erroneous early return from an iterator Bjorn Helgaas
2021-02-18 17:00 ` Bjorn Helgaas
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=20210216205935.3112661-1-kw@linux.com \
--to=kw@linux.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=robh@kernel.org \
--cc=tjoseph@cadence.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.