PCI: dwc: fix error return code in dw_pcie_host_init()
PATCH v2 1/1 PCI: dwc: fix error return code in dw_pcie_host_init()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
---v1->v2: just add 'ret = xxx'
drivers/pci/controller/dwc/pcie-designware-host.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-host.c +2 -1
@@ -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;
Signature · 1 line
2.17.1
Quoted 7 lines · On Tue, 17 Nov 2020 14:41:42 +0800 Wang Hai <[email protected]> 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 <[email protected]>Signed-off-by Wang Hai <[email protected]>
Reviewed-by Jisheng Zhang <[email protected]>
Quoted 22 lines
---
v1->v2: just add 'ret = xxx'drivers/pci/controller/dwc/pcie-designware-host.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/controller/dwc/pcie-designware-host.c +2
-2@@ -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
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.
Quoted 2 lines
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