* [PATCH] RDMA/qedr: clean up work queue on failure in qedr_alloc_resources()
@ 2022-10-25 15:32 Dan Carpenter
2022-10-27 11:48 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-10-25 15:32 UTC (permalink / raw)
To: Michal Kalderon
Cc: Ariel Elior, Jason Gunthorpe, Leon Romanovsky, Ram Amrani,
Doug Ledford, linux-rdma, kernel-janitors
Add a check for if create_singlethread_workqueue() fails and also destroy
the work queue on failure paths.
Fixes: e411e0587e0d ("RDMA/qedr: Add iWARP connection management functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/infiniband/hw/qedr/main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index 5152f10d2e6d..ba0c3e4c07d8 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -344,6 +344,10 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
if (IS_IWARP(dev)) {
xa_init(&dev->qps);
dev->iwarp_wq = create_singlethread_workqueue("qedr_iwarpq");
+ if (!dev->iwarp_wq) {
+ rc = -ENOMEM;
+ goto err1;
+ }
}
/* Allocate Status blocks for CNQ */
@@ -351,7 +355,7 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
GFP_KERNEL);
if (!dev->sb_array) {
rc = -ENOMEM;
- goto err1;
+ goto err_destroy_wq;
}
dev->cnq_array = kcalloc(dev->num_cnq,
@@ -402,6 +406,9 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
kfree(dev->cnq_array);
err2:
kfree(dev->sb_array);
+err_destroy_wq:
+ if (IS_IWARP(dev))
+ destroy_workqueue(dev->iwarp_wq);
err1:
kfree(dev->sgid_tbl);
return rc;
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/qedr: clean up work queue on failure in qedr_alloc_resources()
2022-10-25 15:32 [PATCH] RDMA/qedr: clean up work queue on failure in qedr_alloc_resources() Dan Carpenter
@ 2022-10-27 11:48 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2022-10-27 11:48 UTC (permalink / raw)
To: Michal Kalderon, Dan Carpenter
Cc: Ram Amrani, kernel-janitors, Jason Gunthorpe, linux-rdma,
Ariel Elior, Doug Ledford
On Tue, 25 Oct 2022 18:32:32 +0300, Dan Carpenter wrote:
> Add a check for if create_singlethread_workqueue() fails and also destroy
> the work queue on failure paths.
>
>
Applied, thanks!
[1/1] RDMA/qedr: clean up work queue on failure in qedr_alloc_resources()
https://git.kernel.org/rdma/rdma/c/569ab362c3073a
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-27 11:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 15:32 [PATCH] RDMA/qedr: clean up work queue on failure in qedr_alloc_resources() Dan Carpenter
2022-10-27 11:48 ` Leon Romanovsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.