All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/hfi1: fix error paths in hfi1_mod_init()
@ 2026-11-21  9:39 Wanhui Fu
  2026-11-21  9:42 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-11-21  9:39 UTC (permalink / raw)
  To: dennis.dalessandro, jgg, leon; +Cc: linux-rdma, Wanhui Fu

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

Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
 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-21  9:42 UTC | newest]

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

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.