diff options
author | Gal Pressman <pressmangal@gmail.com> | 2018-08-09 22:00:47 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-08-15 15:08:35 -0600 |
commit | a1ceeca679dccc492235f0f629d9e9f7b3d51ca8 (patch) | |
tree | 2bbf6771dd1b945148ae11e910a189c41e87f3d7 /drivers/infiniband/hw/hns/hns_roce_qp.c | |
parent | IB/core: Change filter function return type from int to bool (diff) | |
download | linux-dev-a1ceeca679dccc492235f0f629d9e9f7b3d51ca8.tar.xz linux-dev-a1ceeca679dccc492235f0f629d9e9f7b3d51ca8.zip |
RDMA/hns: Fix usage of bitmap allocation functions return values
hns bitmap allocation functions return 0 on success and -1 on failure.
Callers of these functions wrongly used their return value as an errno,
fix that by making a proper conversion.
Fixes: a598c6f4c5a8 ("IB/hns: Simplify function of pd alloc and qp alloc")
Signed-off-by: Gal Pressman <pressmangal@gmail.com>
Acked-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/hns/hns_roce_qp.c')
-rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_qp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index c1dbddcd58c9..efb7e961ca65 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -115,7 +115,10 @@ static int hns_roce_reserve_range_qp(struct hns_roce_dev *hr_dev, int cnt, { struct hns_roce_qp_table *qp_table = &hr_dev->qp_table; - return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, base); + return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, + base) ? + -ENOMEM : + 0; } enum hns_roce_qp_state to_hns_roce_state(enum ib_qp_state state) |