hns_roce_alloc_cmd_mailbox() never returns NULL, so the check should be
IS_ERR(). And the error code should be converted as the function's return
value.
Link: https://lore.kernel.org/r/20220302064830.61706-8-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
/* Allocate mailbox memory */
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
- if (IS_ERR_OR_NULL(mailbox))
- return -ENOMEM;
+ if (IS_ERR(mailbox))
+ return PTR_ERR(mailbox);
ret = alloc_eq_buf(hr_dev, eq);
if (ret)
/* Allocate mailbox memory */
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
- if (IS_ERR(mailbox)) {
- ret = PTR_ERR(mailbox);
- return ret;
- }
+ if (IS_ERR(mailbox))
+ return PTR_ERR(mailbox);
if (mr->type != MR_TYPE_FRMR)
ret = hr_dev->hw->write_mtpt(hr_dev, mailbox->buf, mr);
}
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
- if (IS_ERR_OR_NULL(mailbox)) {
+ if (IS_ERR(mailbox)) {
ibdev_err(ibdev, "failed to alloc mailbox for SRQC.\n");
- ret = -ENOMEM;
+ ret = PTR_ERR(mailbox);
goto err_xa;
}