* [PATCH] PCI: dwc: solve returning success but actually failed
@ 2022-03-04 12:06 Zhangjiantao(Kirin,Nanjing)
2022-03-04 17:10 ` Rob Herring
2022-03-04 21:39 ` Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Zhangjiantao(Kirin,Nanjing) @ 2022-03-04 12:06 UTC (permalink / raw)
To: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, robh, kw,
bhelgaas, linux-pci, linux-kernel
Cc: Caiyadong, guhengsheng, zhangjianrong (E)
When dma_mapping_error returns error because of no enough memory available, dw_pcie_host_init will return success, which will mislead the callers.
Signed-off-by: zhangjianrong <zhangjianrong5@huawei.com>
Signed-off-by: zhangjiantao <water.zhangjiantao@huawei.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c
b/drivers/pci/controller/dwc/pcie-designware-host.c
index f4755f3a03be..ac691d733848 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -393,6 +393,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (dma_mapping_error(pci->dev, pp->msi_data)) {
dev_err(pci->dev, "Failed to map MSI data\n");
pp->msi_data = 0;
+ ret = -1;
goto err_free_msi;
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: dwc: solve returning success but actually failed
2022-03-04 12:06 [PATCH] PCI: dwc: solve returning success but actually failed Zhangjiantao(Kirin,Nanjing)
@ 2022-03-04 17:10 ` Rob Herring
2022-03-04 21:39 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2022-03-04 17:10 UTC (permalink / raw)
To: Zhangjiantao(Kirin,Nanjing)
Cc: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, kw, bhelgaas,
linux-pci, linux-kernel, Caiyadong, guhengsheng,
zhangjianrong (E)
On Fri, Mar 4, 2022 at 6:06 AM Zhangjiantao(Kirin,Nanjing)
<water.zhangjiantao@huawei.com> wrote:
>
For the subject, something like: 'PCI: dwc: Fix setting error return
on MSI DMA mapping failure'
> When dma_mapping_error returns error because of no enough memory available, dw_pcie_host_init will return success, which will mislead the callers.
Wrap lines at 72 char.
>
Add a Fixes tag with whatever commit introduced the problem.
> Signed-off-by: zhangjianrong <zhangjianrong5@huawei.com>
> Signed-off-by: zhangjiantao <water.zhangjiantao@huawei.com>
Author and S-o-b names should match.
>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c
> b/drivers/pci/controller/dwc/pcie-designware-host.c
> index f4755f3a03be..ac691d733848 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -393,6 +393,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
> if (dma_mapping_error(pci->dev, pp->msi_data)) {
> dev_err(pci->dev, "Failed to map MSI data\n");
> pp->msi_data = 0;
> + ret = -1;
Use an errno value. ENOMEM seems to be common, but I also see EIO and
EFAULT used.
Rob
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: dwc: solve returning success but actually failed
2022-03-04 12:06 [PATCH] PCI: dwc: solve returning success but actually failed Zhangjiantao(Kirin,Nanjing)
2022-03-04 17:10 ` Rob Herring
@ 2022-03-04 21:39 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2022-03-04 21:39 UTC (permalink / raw)
To: Zhangjiantao(Kirin,Nanjing)
Cc: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, robh, kw,
bhelgaas, linux-pci, linux-kernel, Caiyadong, guhengsheng,
zhangjianrong (E)
On Fri, Mar 04, 2022 at 12:06:10PM +0000, Zhangjiantao(Kirin,Nanjing) wrote:
> When dma_mapping_error returns error because of no enough memory available, dw_pcie_host_init will return success, which will mislead the callers.
Wrap to fit in 75 columns, add "()" after function names.
>
> Signed-off-by: zhangjianrong <zhangjianrong5@huawei.com>
> Signed-off-by: zhangjiantao <water.zhangjiantao@huawei.com>
>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c
> b/drivers/pci/controller/dwc/pcie-designware-host.c
> index f4755f3a03be..ac691d733848 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -393,6 +393,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
> if (dma_mapping_error(pci->dev, pp->msi_data)) {
> dev_err(pci->dev, "Failed to map MSI data\n");
> pp->msi_data = 0;
> + ret = -1;
We should save the return value from dma_mapping_error() and return
*that*, not -1.
Whitespace error (indent with tabs, same as the surrounding code).
> goto err_free_msi;
> }
> }
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-04 21:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 12:06 [PATCH] PCI: dwc: solve returning success but actually failed Zhangjiantao(Kirin,Nanjing)
2022-03-04 17:10 ` Rob Herring
2022-03-04 21:39 ` Bjorn Helgaas
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.