Skip to content

Commit 7a47e07

Browse files
Dan Carpenterjgunthorpe
authored andcommitted
RDMA/qedr: clean up work queue on failure in qedr_alloc_resources()
Add a check for if create_singlethread_workqueue() fails and also destroy the work queue on failure paths. Fixes: e411e05 ("RDMA/qedr: Add iWARP connection management functions") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/Y1gBkDucQhhWj5YM@kili Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 07c0d13 commit 7a47e07

File tree

1 file changed

+8
-1
lines changed
  • drivers/infiniband/hw/qedr

1 file changed

+8
-1
lines changed

drivers/infiniband/hw/qedr/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,18 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
344344
if (IS_IWARP(dev)) {
345345
xa_init(&dev->qps);
346346
dev->iwarp_wq = create_singlethread_workqueue("qedr_iwarpq");
347+
if (!dev->iwarp_wq) {
348+
rc = -ENOMEM;
349+
goto err1;
350+
}
347351
}
348352

349353
/* Allocate Status blocks for CNQ */
350354
dev->sb_array = kcalloc(dev->num_cnq, sizeof(*dev->sb_array),
351355
GFP_KERNEL);
352356
if (!dev->sb_array) {
353357
rc = -ENOMEM;
354-
goto err1;
358+
goto err_destroy_wq;
355359
}
356360

357361
dev->cnq_array = kcalloc(dev->num_cnq,
@@ -402,6 +406,9 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
402406
kfree(dev->cnq_array);
403407
err2:
404408
kfree(dev->sb_array);
409+
err_destroy_wq:
410+
if (IS_IWARP(dev))
411+
destroy_workqueue(dev->iwarp_wq);
405412
err1:
406413
kfree(dev->sgid_tbl);
407414
return rc;

0 commit comments

Comments
 (0)