* [PATCH] PCI: brcmstb: Correctly store and use the output value
@ 2024-09-06 11:09 Muhammad Usama Anjum
2024-09-06 18:20 ` Jim Quinlan
0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Usama Anjum @ 2024-09-06 11:09 UTC (permalink / raw)
To: Jim Quinlan, Nicolas Saenz Julienne, Florian Fainelli,
Broadcom internal kernel review list, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Stanimir Varbanov
Cc: Muhammad Usama Anjum, kernel, Krzysztof Wilczyński,
Jim Quinlan, linux-rpi-kernel, linux-arm-kernel, linux-pci,
linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: brcmstb: Correctly store and use the output value
2024-09-06 11:09 [PATCH] PCI: brcmstb: Correctly store and use the output value Muhammad Usama Anjum
@ 2024-09-06 18:20 ` Jim Quinlan
2024-09-06 18:53 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: Jim Quinlan @ 2024-09-06 18:20 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Jim Quinlan, Nicolas Saenz Julienne, Florian Fainelli,
Broadcom internal kernel review list, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Stanimir Varbanov, kernel,
Krzysztof Wilczyński, linux-rpi-kernel, linux-arm-kernel,
linux-pci, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]
On Fri, Sep 6, 2024 at 7:10 AM Muhammad Usama Anjum
<usama.anjum@collabora.com> wrote:
>
> 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.
Hello Muhammad,
You are correct -- I was asked to make a few variables to be of the
type u8, but I missed having an int (ret) hold the
resultof that call. I believe I am still in the process of submitting
this commit series -- V7 is coming next -- so I will
take your email as a review instead of adding a fixup commit.
Unless Bjorn says that V6 was applied.
Thanks and regards,
Jim Quinlan
Broadcom STB/CM
>
>
> 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
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4210 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: brcmstb: Correctly store and use the output value
2024-09-06 18:20 ` Jim Quinlan
@ 2024-09-06 18:53 ` Florian Fainelli
0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2024-09-06 18:53 UTC (permalink / raw)
To: Jim Quinlan, Muhammad Usama Anjum
Cc: Jim Quinlan, Nicolas Saenz Julienne,
Broadcom internal kernel review list, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Stanimir Varbanov, kernel,
Krzysztof Wilczyński, linux-rpi-kernel, linux-arm-kernel,
linux-pci, linux-kernel
On 9/6/24 11:20, Jim Quinlan wrote:
> On Fri, Sep 6, 2024 at 7:10 AM Muhammad Usama Anjum
> <usama.anjum@collabora.com> wrote:
>>
>> 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.
>
>
> Hello Muhammad,
> You are correct -- I was asked to make a few variables to be of the
> type u8, but I missed having an int (ret) hold the
> resultof that call. I believe I am still in the process of submitting
> this commit series -- V7 is coming next -- so I will
> take your email as a review instead of adding a fixup commit.
>
> Unless Bjorn says that V6 was applied.
A similar patch has already been submitted to address this in a slightly
different way:
https://lore.kernel.org/all/20240904161953.46790-2-riyandhiman14@gmail.com/
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-06 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-06 11:09 [PATCH] PCI: brcmstb: Correctly store and use the output value Muhammad Usama Anjum
2024-09-06 18:20 ` Jim Quinlan
2024-09-06 18:53 ` Florian Fainelli
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®