Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH v2] IB/hfi1: fix error paths in hfi1_mod_init()
@ 2026-11-23  4:15 Wanhui Fu
  2026-11-23  4:19 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-11-23  4:15 UTC (permalink / raw)
  To: dennis.dalessandro, jgg, leon, dledford, sebastian.sanchez,
	dean.luick, mitko.haralanov, mike.marciniszyn, kaike.wan
  Cc: linux-rdma, Wanhui Fu

The error path in hfi1_mod_init() is not completed.
Fix this by add some goto label.

Fixes: d63730192f59 ("IB/hfi1: Reserve and collapse CPU cores for contexts")
Fixes: 48a615dc00ae ("IB/hfi1: Integrate OPFN into RC transactions")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
Changes in v2:
 - Add Fixes tags as suggested by Sashiko.
---
 drivers/infiniband/hw/hfi1/init.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index f94d896e7212..c66d4dea5fc6 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -1388,7 +1388,7 @@ static int __init hfi1_mod_init(void)
 
 	ret = node_affinity_init();
 	if (ret)
-		goto bail;
+		goto bail_dev;
 
 	/* validate max MTU before any devices start */
 	if (!valid_opa_max_mtu(hfi1_max_mtu)) {
@@ -1438,7 +1438,7 @@ static int __init hfi1_mod_init(void)
 	ret = opfn_init();
 	if (ret < 0) {
 		pr_err("Failed to allocate opfn_wq");
-		goto bail_dev;
+		goto bail_affinity;
 	}
 
 	/*
@@ -1449,12 +1449,16 @@ static int __init hfi1_mod_init(void)
 	ret = pci_register_driver(&hfi1_pci_driver);
 	if (ret < 0) {
 		pr_err("Unable to register driver: error %d\n", -ret);
-		goto bail_dev;
+		goto bail_opfn;
 	}
 	goto bail; /* all OK */
 
-bail_dev:
+bail_opfn:
 	hfi1_dbg_exit();
+	opfn_exit();
+bail_affinity:
+	node_affinity_destroy_all();
+bail_dev:
 	dev_cleanup();
 bail:
 	return ret;
-- 
2.25.1


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

end of thread, other threads:[~2026-11-23  4:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  4:15 [PATCH v2] IB/hfi1: fix error paths in hfi1_mod_init() Wanhui Fu
2026-11-23  4:19 ` sashiko-bot

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