nfp: Fix passing zero to 'PTR_ERR'
Subsystems (3)
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")
Signed-off-by YueHaibing <[email protected]>
--- 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
@@ -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
Quoted 5 lines · YueHaibing
nfp_cpp_from_nfp6000_pcie()returnsERR_PTR()and never returns NULL. The NULL test should be removed, also return correct err.Fixes 63461a028f76 ("nfp: add the PF driver")Signed-off-by YueHaibing <[email protected]>
Thanks, this does indeed seem to be the case.
Reviewed-by Simon Horman <[email protected]>
Jakub Kicinski
maintainerQuoted 10 lines · On Thu, 12 Nov 2020 16:26:03 +0100 Simon Horman wrote:
Quoted 5 lines · YueHaibing
nfp_cpp_from_nfp6000_pcie()returnsERR_PTR()and never returns NULL. The NULL test should be removed, also return correct err.Fixes 63461a028f76 ("nfp: add the PF driver")Signed-off-by YueHaibing <[email protected]>Thanks, this does indeed seem to be the case.
Reviewed-by Simon Horman <[email protected]>
Thanks!
I'll drop the fixes tag and apply to net-next, though. Unnecessary NULL-check is hardly a bug.