RDMA/hns: Avoid NULL pointer exception
After the loop in hns_roce_v1_mr_free_work_fn function, it is possible that all qps will have been freed (in which case ne will be 0). If that happens, then later in the function when we dereference hr_qp we will get an exception. Check ne is not 0 to make sure we actually have an hr_qp left to work on. This patch fixes the smatch error as below: drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1009 hns_roce_v1_mr_free_work_fn() error: we previously assumed 'hr_qp' could be null Signed-off-by: NWei Hu (Xavier) <xavier.huwei@huawei.com> Signed-off-by: NLijun Ou <oulijun@huawei.com> Signed-off-by: NShaobo Xu <xushaobo2@huawei.com> Signed-off-by: NDoug Ledford <dledford@redhat.com>
Showing
想要评论请 注册 或 登录