RDMA/hns: Add releasing resource operation in error branch

This patch adds releasing resource operation in error branch
of the function named hns_roce_table_get.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Wei Hu(Xavier) 2017-08-30 17:23:16 +08:00 committed by Doug Ledford
parent 3958cc564e
commit 08eb3018b6
1 changed files with 2 additions and 0 deletions

View File

@ -563,6 +563,8 @@ int hns_roce_table_get(struct hns_roce_dev *hr_dev,
/* Set HEM base address(128K/page, pa) to Hardware */
if (hns_roce_set_hem(hr_dev, table, obj)) {
hns_roce_free_hem(hr_dev, table->hem[i]);
table->hem[i] = NULL;
ret = -ENODEV;
dev_err(dev, "set HEM base address to HW failed.\n");
goto out;