RDMA/hns: Fix mismatch exception rollback
authorwenglianfa <wenglianfa@huawei.com>
Fri, 12 Apr 2024 09:16:12 +0000 (17:16 +0800)
committerLeon Romanovsky <leon@kernel.org>
Tue, 16 Apr 2024 12:06:47 +0000 (15:06 +0300)
When dma_alloc_coherent() fails in hns_roce_alloc_hem(), just call
kfree() to release hem instead of hns_roce_free_hem().

Fixes: c00743cbf2b8 ("RDMA/hns: Simplify 'struct hns_roce_hem' allocation")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240412091616.370789-7-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/hns/hns_roce_hem.c

index a9ea55506779d9759875d70571ea70df6c3aee7f..1c2ec803e030338fd5b69a966edb821cd83d2f80 100644 (file)
@@ -281,7 +281,7 @@ static struct hns_roce_hem *hns_roce_alloc_hem(struct hns_roce_dev *hr_dev,
        return hem;
 
 fail:
-       hns_roce_free_hem(hr_dev, hem);
+       kfree(hem);
        return NULL;
 }