linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfp: Fix passing zero to 'PTR_ERR'
@ 2020-11-12 14:58 YueHaibing
  2020-11-12 15:26 ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2020-11-12 14:58 UTC (permalink / raw)
  To: simon.horman, kuba, davem, yuehaibing; +Cc: oss-drivers, netdev, linux-kernel

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 <yuehaibing@huawei.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c
index 7ff2ccbd43b0..e672614d2906 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c
@@ -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;
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nfp: Fix passing zero to 'PTR_ERR'
  2020-11-12 14:58 [PATCH] nfp: Fix passing zero to 'PTR_ERR' YueHaibing
@ 2020-11-12 15:26 ` Simon Horman
  2020-11-12 18:10   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2020-11-12 15:26 UTC (permalink / raw)
  To: YueHaibing; +Cc: kuba, davem, oss-drivers, netdev, linux-kernel

On Thu, Nov 12, 2020 at 10:58:52PM +0800, YueHaibing wrote:
> 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 <yuehaibing@huawei.com>

Thanks, this does indeed seem to be the case.

Reviewed-by: Simon Horman <simon.horman@netronome.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nfp: Fix passing zero to 'PTR_ERR'
  2020-11-12 15:26 ` Simon Horman
@ 2020-11-12 18:10   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-12 18:10 UTC (permalink / raw)
  To: Simon Horman; +Cc: YueHaibing, davem, oss-drivers, netdev, linux-kernel

On Thu, 12 Nov 2020 16:26:03 +0100 Simon Horman wrote:
> On Thu, Nov 12, 2020 at 10:58:52PM +0800, YueHaibing wrote:
> > 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 <yuehaibing@huawei.com>  
> 
> Thanks, this does indeed seem to be the case.
> 
> Reviewed-by: Simon Horman <simon.horman@netronome.com>

Thanks!

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-12 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 14:58 [PATCH] nfp: Fix passing zero to 'PTR_ERR' YueHaibing
2020-11-12 15:26 ` Simon Horman
2020-11-12 18:10   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).