提交 08ff7818 编写于 作者: D Dan Carpenter 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册