cxl/pci: Fix potential bogus return value upon successful probing
Davidlohr Bueso
maintainerPATCH v2 1/1 cxl/pci: Fix potential bogus return value upon successful probing
If cxl_pci_ras_unmask() returns non-zero, cxl_pci_probe() will end up returning that value, instead of zero.
---
Changes from v1:
- Picked up Fan's review tag.
- Continue to return rc (Alison).
drivers/cxl/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cxl/pci.c +1 -2
@@ -1032,8 +1032,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (rc)return rc; - rc =cxl_pci_ras_unmask (pdev); -if (rc) +if (cxl_pci_ras_unmask (pdev))dev_dbg (&pdev->dev,"No RAS reporting unmasked\n" );pci_save_state (pdev);
Signature · 1 line
2.47.0
Quoted 6 lines · Davidlohr Bueso
If
cxl_pci_ras_unmask()returns non-zero,cxl_pci_probe()will end up returning that value, instead of zero.Fixes 248529edc86 (cxl: add RAS status unmasking for CXL)Reviewed-by Fan Ni <[email protected]>Signed-off-by Davidlohr Bueso <[email protected]>
NIT below. But.
Quoted 13 lines
---
Changes from v1:
- Picked up Fan's review tag.
- Continue to return rc (Alison).drivers/cxl/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/cxl/pci.c +0
-0
drivers/cxl/pci.c static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 1036
Quoted 5 lines
drivers/cxl/pci.c +0
-2@@ -1032,8 +1032,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (rc)return rc; - rc =cxl_pci_ras_unmask (pdev); -if (rc)
Technically if we are here...
drivers/cxl/pci.c static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 1038
Quoted 4 lines
drivers/cxl/pci.c +1
-0+if (cxl_pci_ras_unmask (pdev))dev_dbg (&pdev->dev,"No RAS reporting unmasked\n" );pci_save_state (pdev);
... Then a simple ...
return 0;
At the end would be more straight forward.
But this patch is fine,
Ira
[snip]
Alison Schofield
maintainerQuoted 10 lines · Davidlohr Bueso
If
cxl_pci_ras_unmask()returns non-zero,cxl_pci_probe()will end up returning that value, instead of zero.Fixes 248529edc86 (cxl: add RAS status unmasking for CXL)Reviewed-by Fan Ni <[email protected]>Signed-off-by Davidlohr Bueso <[email protected]>---
Changes from v1:
- Picked up Fan's review tag.
- Continue to return rc (Alison).
I thought I said opposite -
"I agree that the return value should be 0 if we get this far, because all rc's that need to be returned, are returned immediately."
Regardless - it fixes what it said it will fix, as did v1.
Quoted 21 lines
drivers/cxl/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/cxl/pci.c +1
-2@@ -1032,8 +1032,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (rc)return rc; - rc =cxl_pci_ras_unmask (pdev); -if (rc) +if (cxl_pci_ras_unmask (pdev))dev_dbg (&pdev->dev,"No RAS reporting unmasked\n" );pci_save_state (pdev);Signature · 1 line
2.47.0