From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: "Jim Quinlan" <jim2101024@gmail.com>,
"Nicolas Saenz Julienne" <nsaenz@kernel.org>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Stanimir Varbanov" <svarbanov@suse.de>
Cc: "Muhammad Usama Anjum" <usama.anjum@collabora.com>,
kernel@collabora.com,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Jim Quinlan" <james.quinlan@broadcom.com>,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] PCI: brcmstb: Correctly store and use the output value
Date: Fri, 6 Sep 2024 16:09:31 +0500 [thread overview]
Message-ID: <20240906110932.299689-1-usama.anjum@collabora.com> (raw)
brcm_pcie_get_inbound_wins() can return negative error. As
num_inbound_wins is unsigned, we'll be unable to recognize the error.
Hence store return value of brcm_pcie_get_inbound_wins() in ret which is
signed and store result back to num_inbound_wins after confirming that
it isn't negative.
Fixes: 46c981fd60de ("PCI: brcmstb: Refactor for chips with many regular inbound windows")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
drivers/pci/controller/pcie-brcmstb.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 55311dc47615d..054810d7962d7 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1090,9 +1090,10 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK);
writel(tmp, base + PCIE_MISC_MISC_CTRL);
- num_inbound_wins = brcm_pcie_get_inbound_wins(pcie, inbound_wins);
- if (num_inbound_wins < 0)
- return num_inbound_wins;
+ ret = brcm_pcie_get_inbound_wins(pcie, inbound_wins);
+ if (ret < 0)
+ return ret;
+ num_inbound_wins = (u8)ret;
set_inbound_win_registers(pcie, inbound_wins, num_inbound_wins);
--
2.39.2
next reply other threads:[~2024-09-06 11:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 11:09 Muhammad Usama Anjum [this message]
2024-09-06 18:20 ` Jim Quinlan
2024-09-06 18:53 ` Florian Fainelli
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=20240906110932.299689-1-usama.anjum@collabora.com \
--to=usama.anjum@collabora.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhelgaas@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=james.quinlan@broadcom.com \
--cc=jim2101024@gmail.com \
--cc=kernel@collabora.com \
--cc=kw@linux.com \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=nsaenz@kernel.org \
--cc=robh@kernel.org \
--cc=svarbanov@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®