linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: fix error return code in dw_pcie_host_init()
@ 2020-11-16 13:50 Wang Hai
  2020-11-17  1:49 ` Jisheng Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Hai @ 2020-11-16 13:50 UTC (permalink / raw)
  To: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, robh, bhelgaas,
	Jisheng.Zhang
  Cc: linux-pci, linux-kernel

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 07940c369a6b ("PCI: dwc: Fix MSI page leakage in suspend/resume")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@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 44c2a6572199..7b3c91c6ae02 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -395,6 +395,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 = -ENOMEM;
 				goto err_free_msi;
 			}
 		} else {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: dwc: fix error return code in dw_pcie_host_init()
  2020-11-16 13:50 [PATCH] PCI: dwc: fix error return code in dw_pcie_host_init() Wang Hai
@ 2020-11-17  1:49 ` Jisheng Zhang
  2020-11-17  6:54   ` wanghai (M)
  0 siblings, 1 reply; 3+ messages in thread
From: Jisheng Zhang @ 2020-11-17  1:49 UTC (permalink / raw)
  To: Wang Hai
  Cc: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, robh, bhelgaas,
	linux-pci, linux-kernel

On Mon, 16 Nov 2020 21:50:23 +0800 Wang Hai wrote:

> 
> 
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.

good catch.

> 
> Fixes: 07940c369a6b ("PCI: dwc: Fix MSI page leakage in suspend/resume")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@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 44c2a6572199..7b3c91c6ae02 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -395,6 +395,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 = -ENOMEM;

what about use the return value of dma_maping_error()? I.E

ret = dma_mapping_error()
if (ret) {
....
}

>                                 goto err_free_msi;
>                         }
>                 } else {
> --
> 2.17.1
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: dwc: fix error return code in dw_pcie_host_init()
  2020-11-17  1:49 ` Jisheng Zhang
@ 2020-11-17  6:54   ` wanghai (M)
  0 siblings, 0 replies; 3+ messages in thread
From: wanghai (M) @ 2020-11-17  6:54 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, robh, bhelgaas,
	linux-pci, linux-kernel


在 2020/11/17 9:49, Jisheng Zhang 写道:
> On Mon, 16 Nov 2020 21:50:23 +0800 Wang Hai wrote:
>
>>
>> Fix to return a negative error code from the error handling
>> case instead of 0, as done elsewhere in this function.
> good catch.
>
>> Fixes: 07940c369a6b ("PCI: dwc: Fix MSI page leakage in suspend/resume")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Wang Hai <wanghai38@huawei.com>
>>
>>                          if (dma_mapping_error(pci->dev, pp->msi_data)) {
>>                                  dev_err(pci->dev, "Failed to map MSI data\n");
>>                                  pp->msi_data = 0;
>> +                               ret = -ENOMEM;
> what about use the return value of dma_maping_error()? I.E
>
> ret = dma_mapping_error()
> if (ret) {
> ....
> }
>

Thanks for your review,  I just sent v2

"[PATCH v2] PCI: dwc: fix error return code in dw_pcie_host_init()"

> .
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-17  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 13:50 [PATCH] PCI: dwc: fix error return code in dw_pcie_host_init() Wang Hai
2020-11-17  1:49 ` Jisheng Zhang
2020-11-17  6:54   ` wanghai (M)

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).