Commit 08ff7818 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

octeontx2-pf: Fix an IS_ERR() vs NULL bug

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

Fixes: 34bfe0eb ("octeontx2-pf: MTU, MAC and RX mode config support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 784f8344
...@@ -171,9 +171,9 @@ static int otx2_hw_get_mac_addr(struct otx2_nic *pfvf, ...@@ -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); msghdr = otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
if (!msghdr) { if (IS_ERR(msghdr)) {
otx2_mbox_unlock(&pfvf->mbox); otx2_mbox_unlock(&pfvf->mbox);
return -ENOMEM; return PTR_ERR(msghdr);
} }
rsp = (struct nix_get_mac_addr_rsp *)msghdr; rsp = (struct nix_get_mac_addr_rsp *)msghdr;
ether_addr_copy(netdev->dev_addr, rsp->mac_addr); ether_addr_copy(netdev->dev_addr, rsp->mac_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment