* [PATCH pci] PCI: dwc: fix inverted condition of DMA mask setup warning
@ 2020-12-22 15:07 Alexander Lobakin
2020-12-23 18:58 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Lobakin @ 2020-12-22 15:07 UTC (permalink / raw)
To: Bjorn Helgaas, Lorenzo Pieralisi
Cc: Jingoo Han, Gustavo Pimentel, Rob Herring, Vidya Sagar,
Robin Murphy, Alexander Lobakin, linux-pci, linux-kernel
Commit 660c486590aa ("PCI: dwc: Set 32-bit DMA mask for MSI target
address allocation") added dma_mask_set() call to explicitly set
32-bit DMA mask for MSI message mapping, but for now it throws a
warning on ret == 0, while dma_set_mask() returns 0 in case of
success.
Fix this by inverting the condition.
Misc: remove redundant braces around single statement.
Fixes: 660c486590aa ("PCI: dwc: Set 32-bit DMA mask for MSI target address allocation")
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 516b151e0ef3..fa40cc2e376f 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -397,12 +397,11 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp);
ret = dma_set_mask(pci->dev, DMA_BIT_MASK(32));
- if (!ret) {
+ if (ret)
dev_warn(pci->dev,
"Failed to set DMA mask to 32-bit. "
"Devices with only 32-bit MSI support"
" may not work properly\n");
- }
pp->msi_data = dma_map_single_attrs(pci->dev, &pp->msi_msg,
sizeof(pp->msi_msg),
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH pci] PCI: dwc: fix inverted condition of DMA mask setup warning
2020-12-22 15:07 [PATCH pci] PCI: dwc: fix inverted condition of DMA mask setup warning Alexander Lobakin
@ 2020-12-23 18:58 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2020-12-23 18:58 UTC (permalink / raw)
To: Alexander Lobakin, Vidya Sagar
Cc: Bjorn Helgaas, Lorenzo Pieralisi, Jingoo Han, Gustavo Pimentel,
Rob Herring, Robin Murphy, linux-pci, linux-kernel
On Tue, Dec 22, 2020 at 03:07:43PM +0000, Alexander Lobakin wrote:
> Commit 660c486590aa ("PCI: dwc: Set 32-bit DMA mask for MSI target
> address allocation") added dma_mask_set() call to explicitly set
> 32-bit DMA mask for MSI message mapping, but for now it throws a
> warning on ret == 0, while dma_set_mask() returns 0 in case of
> success.
> Fix this by inverting the condition.
>
> Misc: remove redundant braces around single statement.
>
> Fixes: 660c486590aa ("PCI: dwc: Set 32-bit DMA mask for MSI target address allocation")
> Signed-off-by: Alexander Lobakin <alobakin@pm.me>
I joined the string to make it greppable and applied to for-linus for
v5.11, thanks!
Vidya, speak up if this isn't right. I assume you should have seen
this spurious warning while testing 660c486590aa.
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 516b151e0ef3..fa40cc2e376f 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -397,12 +397,11 @@ int dw_pcie_host_init(struct pcie_port *pp)
> pp);
>
> ret = dma_set_mask(pci->dev, DMA_BIT_MASK(32));
> - if (!ret) {
> + if (ret)
> dev_warn(pci->dev,
> "Failed to set DMA mask to 32-bit. "
> "Devices with only 32-bit MSI support"
> " may not work properly\n");
> - }
>
> pp->msi_data = dma_map_single_attrs(pci->dev, &pp->msi_msg,
> sizeof(pp->msi_msg),
> --
> 2.29.2
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-23 18:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 15:07 [PATCH pci] PCI: dwc: fix inverted condition of DMA mask setup warning Alexander Lobakin
2020-12-23 18:58 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).