Skip to contentSkip to conversation

nfp: Fix passing zero to 'PTR_ERR'

PATCH In review YueHaibing 3 participants 3 messages Nov 12, 2020

Subsystems (3)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 nfp: Fix passing zero to 'PTR_ERR'

nfp_cpp_from_nfp6000_pcie() returns ERR_PTR() and never returns NULL. The NULL test should be removed, also return correct err.

Fixes 63461a028f76 ("nfp: add the PF driver")
---
 drivers/net/ethernet/netronome/nfp/nfp_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/netronome/nfp/nfp_main.c +1 -3
index 7ff2ccbd43b0..e672614d2906 100644
@@ -724,10 +724,8 @@ static int nfp_pci_probe(struct pci_dev *pdev,
 	}
 
 	pf->cpp = nfp_cpp_from_nfp6000_pcie(pdev);
-	if (IS_ERR_OR_NULL(pf->cpp)) {
+	if (IS_ERR(pf->cpp)) {
 		err = PTR_ERR(pf->cpp);
-		if (err >= 0)
-			err = -ENOMEM;
 		goto err_disable_msix;
 	}
 
Signature · 1 line
2.17.1
maintainer
#2 lore raw
Quoted 10 lines · On Thu, 12 Nov 2020 16:26:03 +0100 Simon Horman wrote:
Quoted 5 lines · YueHaibing

nfp_cpp_from_nfp6000_pcie() returns ERR_PTR() and never returns NULL. The NULL test should be removed, also return correct err.

Fixes 63461a028f76 ("nfp: add the PF driver")

Thanks, this does indeed seem to be the case.

Thanks!

I'll drop the fixes tag and apply to net-next, though. Unnecessary NULL-check is hardly a bug.