* [PATCH v2 for-next] RDMA/hns: Release qp resources when failed to destroy qp
@ 2019-10-09 1:21 Weihang Li
2019-10-21 20:42 ` Doug Ledford
0 siblings, 1 reply; 3+ messages in thread
From: Weihang Li @ 2019-10-09 1:21 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm
From: Yangyang Li <liyangyang20@huawei.com>
Even if no response from hardware, we should make sure that qp related
resources are released to avoid memory leaks.
Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08 SoC")
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Weihang Li <liweihang@hisilicon.com>
---
Changelog:
v1->v2: Add Fixes line.
---
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 5b2efc8..73070e2 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -5136,7 +5136,7 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev,
struct hns_roce_cq *send_cq, *recv_cq;
struct ib_device *ibdev = &hr_dev->ib_dev;
unsigned long flags;
- int ret;
+ int ret = 0;
if ((hr_qp->ibqp.qp_type == IB_QPT_RC ||
hr_qp->ibqp.qp_type == IB_QPT_UD) &&
@@ -5144,10 +5144,8 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev,
/* Modify qp to reset before destroying qp */
ret = hns_roce_v2_modify_qp(&hr_qp->ibqp, NULL, 0,
hr_qp->state, IB_QPS_RESET);
- if (ret) {
+ if (ret)
ibdev_err(ibdev, "modify QP to Reset failed.\n");
- return ret;
- }
}
send_cq = hr_qp->ibqp.send_cq ? to_hr_cq(hr_qp->ibqp.send_cq) : NULL;
@@ -5217,7 +5215,7 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev,
kfree(hr_qp->rq_inl_buf.wqe_list);
}
- return 0;
+ return ret;
}
static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
@@ -5227,11 +5225,9 @@ static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
int ret;
ret = hns_roce_v2_destroy_qp_common(hr_dev, hr_qp, udata);
- if (ret) {
+ if (ret)
ibdev_err(&hr_dev->ib_dev, "Destroy qp 0x%06lx failed(%d)\n",
hr_qp->qpn, ret);
- return ret;
- }
if (hr_qp->ibqp.qp_type == IB_QPT_GSI)
kfree(hr_to_hr_sqp(hr_qp));
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 for-next] RDMA/hns: Release qp resources when failed to destroy qp
2019-10-09 1:21 [PATCH v2 for-next] RDMA/hns: Release qp resources when failed to destroy qp Weihang Li
@ 2019-10-21 20:42 ` Doug Ledford
2019-10-22 1:24 ` Weihang Li
0 siblings, 1 reply; 3+ messages in thread
From: Doug Ledford @ 2019-10-21 20:42 UTC (permalink / raw)
To: Weihang Li, jgg; +Cc: linux-rdma, linuxarm
[-- Attachment #1: Type: text/plain, Size: 751 bytes --]
On Wed, 2019-10-09 at 09:21 +0800, Weihang Li wrote:
> From: Yangyang Li <liyangyang20@huawei.com>
>
> Even if no response from hardware, we should make sure that qp related
> resources are released to avoid memory leaks.
>
> Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08
> SoC")
>
> Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
> Signed-off-by: Weihang Li <liweihang@hisilicon.com>
>
Thanks, applied to for-next. For the future sake, no space between
Fixes: and Signed-off-by: lines please. They're all just metadata, they
don't need to be separated.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: B826A3330E572FDD
Fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 for-next] RDMA/hns: Release qp resources when failed to destroy qp
2019-10-21 20:42 ` Doug Ledford
@ 2019-10-22 1:24 ` Weihang Li
0 siblings, 0 replies; 3+ messages in thread
From: Weihang Li @ 2019-10-22 1:24 UTC (permalink / raw)
To: Doug Ledford, jgg; +Cc: linux-rdma, linuxarm
On 2019/10/22 4:42, Doug Ledford wrote:
> On Wed, 2019-10-09 at 09:21 +0800, Weihang Li wrote:
>> From: Yangyang Li <liyangyang20@huawei.com>
>>
>> Even if no response from hardware, we should make sure that qp related
>> resources are released to avoid memory leaks.
>>
>> Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08
>> SoC")
>>
>> Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
>> Signed-off-by: Weihang Li <liweihang@hisilicon.com>
>>
>
> Thanks, applied to for-next. For the future sake, no space between
> Fixes: and Signed-off-by: lines please. They're all just metadata, they
> don't need to be separated.
>
OK, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-22 1:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 1:21 [PATCH v2 for-next] RDMA/hns: Release qp resources when failed to destroy qp Weihang Li
2019-10-21 20:42 ` Doug Ledford
2019-10-22 1:24 ` Weihang Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).