Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/irdma: Clean up resources on cleanup_wq allocation failure
@ 2026-12-05 13:47 Serhat Kumral
  2026-12-05 14:01 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Serhat Kumral @ 2026-12-05 13:47 UTC (permalink / raw)
  To: Tatyana Nikolova, linux-rdma
  Cc: Jason Gunthorpe, Leon Romanovsky, Serhat Kumral

In irdma_rt_init_hw(), all error paths inside the do { ... } while (0)
block break out to invoke irdma_rt_deinit_hw(), except the
alloc_workqueue() failure for iwdev->cleanup_wq, which returns -ENOMEM
directly. This skips cleaning up previously initialized resources
and callers do not call irdma_rt_deinit_hw() when irdma_rt_init_hw() fails.

Set status to -ENOMEM and break out of the block so
irdma_rt_deinit_hw() runs properly on failure.

Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitions")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
 drivers/infiniband/hw/irdma/hw.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c
index e71089fd5f56..675b8074928d 100644
--- a/drivers/infiniband/hw/irdma/hw.c
+++ b/drivers/infiniband/hw/irdma/hw.c
@@ -2025,8 +2025,10 @@ int irdma_rt_init_hw(struct irdma_device *iwdev,
 		 */
 		iwdev->cleanup_wq = alloc_workqueue("irdma-cleanup-wq",
 					WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
-		if (!iwdev->cleanup_wq)
-			return -ENOMEM;
+		if (!iwdev->cleanup_wq) {
+			status = -ENOMEM;
+			break;
+		}
 		irdma_get_used_rsrc(iwdev);
 		init_waitqueue_head(&iwdev->suspend_wq);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-05 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 13:47 [PATCH] RDMA/irdma: Clean up resources on cleanup_wq allocation failure Serhat Kumral
2026-12-05 14:01 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox