* [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
* Re: [PATCH] IB/hfi1: fix error paths in hfi1_mod_init()
2026-11-21 9:39 [PATCH] IB/hfi1: fix error paths in hfi1_mod_init() Wanhui Fu
@ 2026-11-21 9:42 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-21 9:42 UTC (permalink / raw)
To: Wanhui Fu; +Cc: linux-rdma
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] IB/hfi1: missing Fixes: trailers on hfi1_mod_init() error-path
leak fix
--
commit 02fcb0aee43546fd5e57fb0f21507c7ab7cce12f
Author: Wanhui Fu <fuwh1120@163.com>
> IB/hfi1: fix error paths in hfi1_mod_init()
>
> 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>
[Severity: Low]
Since this fixes module-init error-path leaks introduced by d63730192f59
("IB/hfi1: Reserve and collapse CPU cores for contexts") and 48a615dc00ae
("IB/hfi1: Integrate OPFN into RC transactions"), should this include:
Fixes: d63730192f59 ("IB/hfi1: Reserve and collapse CPU cores for contexts")
Fixes: 48a615dc00ae ("IB/hfi1: Integrate OPFN into RC transactions")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121093901.427880-1-fuwh1120@163.com?part=1
^ permalink raw reply [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.