netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] octeontx2-pf: Fix an IS_ERR() vs NULL bug
@ 2020-01-31  5:02 Dan Carpenter
  2020-02-01 19:41 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-01-31  5:02 UTC (permalink / raw)
  To: Sunil Goutham
  Cc: Geetha sowjanya, Subbaraya Sundeep, hariprasad, David S. Miller,
	Tomasz Duszynski, netdev, kernel-janitors

The otx2_mbox_get_rsp() function never returns NULL, it returns error
pointers on error.

Fixes: 34bfe0ebedb7 ("octeontx2-pf: MTU, MAC and RX mode config support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 8247d21d0432..b945bd3d5d88 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -171,9 +171,9 @@ static int otx2_hw_get_mac_addr(struct otx2_nic *pfvf,
 	}
 
 	msghdr = otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
-	if (!msghdr) {
+	if (IS_ERR(msghdr)) {
 		otx2_mbox_unlock(&pfvf->mbox);
-		return -ENOMEM;
+		return PTR_ERR(msghdr);
 	}
 	rsp = (struct nix_get_mac_addr_rsp *)msghdr;
 	ether_addr_copy(netdev->dev_addr, rsp->mac_addr);
-- 
2.11.0


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

* Re: [PATCH net] octeontx2-pf: Fix an IS_ERR() vs NULL bug
  2020-01-31  5:02 [PATCH net] octeontx2-pf: Fix an IS_ERR() vs NULL bug Dan Carpenter
@ 2020-02-01 19:41 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-02-01 19:41 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep, hariprasad,
	David S. Miller, Tomasz Duszynski, netdev, kernel-janitors

On Fri, 31 Jan 2020 08:02:41 +0300, Dan Carpenter wrote:
> The otx2_mbox_get_rsp() function never returns NULL, it returns error
> pointers on error.
> 
> Fixes: 34bfe0ebedb7 ("octeontx2-pf: MTU, MAC and RX mode config support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied

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

end of thread, other threads:[~2020-02-01 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31  5:02 [PATCH net] octeontx2-pf: Fix an IS_ERR() vs NULL bug Dan Carpenter
2020-02-01 19:41 ` 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).