PCI: dwc: fix error return code in dw_pcie_host_init()
PATCH 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.
--- drivers/pci/controller/dwc/pcie-designware-host.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-designware-host.c +1 -0
@@ -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 {
Signature · 1 line
2.17.1
Quoted 4 lines · 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.
Quoted 13 lines
Fixes 07940c369a6b ("PCI: dwc: Fix MSI page leakage in suspend/resume")Reported-by Hulk Robot <[email protected]>Signed-off-by Wang Hai <[email protected]>--- drivers/pci/controller/dwc/pcie-designware-host.c | 1 + 1 file changed, 1 insertion(+)drivers/pci/controller/dwc/pcie-designware-host.c +0
-0
drivers/pci/controller/dwc/pcie-designware-host.c int dw_pcie_host_init(struct pcie_port *pp) · line 398
Quoted 4 lines
drivers/pci/controller/dwc/pcie-designware-host.c +1
-0@@ -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) {
....
}
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-host.c +0
-1goto err_free_msi; } }else { --2.17.1
Quoted 15 lines · Jisheng Zhang
Quoted 3 lines · 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.
Quoted 8 lines
Fixes 07940c369a6b ("PCI: dwc: Fix MSI page leakage in suspend/resume")Reported-by Hulk Robot <[email protected]>Signed-off-by Wang Hai <[email protected]>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;
Quoted 7 lines
what about use the return value of
dma_maping_error()? I.Eret =
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()"
Quoted 2 lines
.