linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] PCI: dwc: fix error return code in dw_pcie_host_init()
@ 2020-11-17  6:41 Wang Hai
  2020-11-17  6:56 ` Jisheng Zhang
  2020-11-19 16:02 ` Krzysztof Wilczyński
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Hai @ 2020-11-17  6:41 UTC (permalink / raw)
  To: Jisheng.Zhang, jingoohan1, gustavo.pimentel, lorenzo.pieralisi,
	robh, bhelgaas
  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>
---
v1->v2: just add 'ret = xxx'
 drivers/pci/controller/dwc/pcie-designware-host.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 44c2a6572199..42d8116a4a00 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -392,7 +392,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
 						      sizeof(pp->msi_msg),
 						      DMA_FROM_DEVICE,
 						      DMA_ATTR_SKIP_CPU_SYNC);
-			if (dma_mapping_error(pci->dev, pp->msi_data)) {
+			ret = dma_mapping_error(pci->dev, pp->msi_data);
+			if (ret) {
 				dev_err(pci->dev, "Failed to map MSI data\n");
 				pp->msi_data = 0;
 				goto err_free_msi;
-- 
2.17.1


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

* Re: [PATCH v2] PCI: dwc: fix error return code in dw_pcie_host_init()
  2020-11-17  6:41 [PATCH v2] PCI: dwc: fix error return code in dw_pcie_host_init() Wang Hai
@ 2020-11-17  6:56 ` Jisheng Zhang
  2020-11-19 16:02 ` Krzysztof Wilczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Jisheng Zhang @ 2020-11-17  6:56 UTC (permalink / raw)
  To: Wang Hai
  Cc: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, robh, bhelgaas,
	linux-pci, linux-kernel

On Tue, 17 Nov 2020 14:41:42 +0800 Wang Hai <wanghai38@huawei.com> wrote:


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

Reviewed-by Jisheng Zhang <Jisheng.Zhang@synaptics.com>

> ---
> v1->v2: just add 'ret = xxx'
>  drivers/pci/controller/dwc/pcie-designware-host.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 44c2a6572199..42d8116a4a00 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -392,7 +392,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
>                                                       sizeof(pp->msi_msg),
>                                                       DMA_FROM_DEVICE,
>                                                       DMA_ATTR_SKIP_CPU_SYNC);
> -                       if (dma_mapping_error(pci->dev, pp->msi_data)) {
> +                       ret = dma_mapping_error(pci->dev, pp->msi_data);
> +                       if (ret) {
>                                 dev_err(pci->dev, "Failed to map MSI data\n");
>                                 pp->msi_data = 0;
>                                 goto err_free_msi;
> --
> 2.17.1
> 


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

* Re: [PATCH v2] PCI: dwc: fix error return code in dw_pcie_host_init()
  2020-11-17  6:41 [PATCH v2] PCI: dwc: fix error return code in dw_pcie_host_init() Wang Hai
  2020-11-17  6:56 ` Jisheng Zhang
@ 2020-11-19 16:02 ` Krzysztof Wilczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2020-11-19 16:02 UTC (permalink / raw)
  To: Wang Hai
  Cc: Jisheng.Zhang, jingoohan1, gustavo.pimentel, lorenzo.pieralisi,
	robh, bhelgaas, linux-pci, linux-kernel

Hi Hai,

Thank you for taking care about this.

On 20-11-17 14:41:42, Wang Hai wrote:

I would have to ask you to capitalise the first letter in the subject
line as it has been done for other patches.  Check Git history to see
what it normally would look like.

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

The above commit message was taken from the first patch, and might not
be accurate any more.  As now you are passing an error code from the
dma_mapping_error() function rather than just setting the ret variable.

Also, the ret variable might have either undetermined value or some
other value from previous assignment, not necessarily 0 there.

Krzysztof

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

end of thread, other threads:[~2020-11-19 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17  6:41 [PATCH v2] PCI: dwc: fix error return code in dw_pcie_host_init() Wang Hai
2020-11-17  6:56 ` Jisheng Zhang
2020-11-19 16:02 ` Krzysztof Wilczyński

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