[PATCH rdma-next 12/13] RDMA/hfi1: Initialize debugfs after probe completes
From: Leon Romanovsky
Date: Wed Jul 08 2026 - 06:50:35 EST
From: Leon Romanovsky <leonro@xxxxxxxxxx>
Commit ed6f653fe430 ("staging/rdma/hfi1: Fix debugfs access race") moved
debugfs creation after device initialization and IB registration so users
cannot access the files before the driver is ready. However, init_one()
still creates them before character device creation and SDMA startup
finish.
Move hfi1_dbg_ibdev_init() to the end of the successful probe path,
matching hfi1_dbg_ibdev_exit() as the first action in remove_one().
Fixes: ed6f653fe430 ("staging/rdma/hfi1: Fix debugfs access race")
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
---
drivers/infiniband/hw/hfi1/init.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index d17f319ad9f2..9ed7c1ffc93c 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -1635,11 +1635,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
* Now ready for use. this should be cleared whenever we
* detect a reset, or initiate one.
*/
- if (!initfail && !ret) {
+ if (!initfail && !ret)
dd->flags |= HFI1_INITTED;
- /* create debufs files after init and ib register */
- hfi1_dbg_ibdev_init(&dd->verbs_dev);
- }
if (initfail || ret) {
msix_clean_up_interrupts(dd);
@@ -1665,6 +1662,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
ERR_PTR(ret));
sdma_start(dd);
+ hfi1_dbg_ibdev_init(&dd->verbs_dev);
return 0;
--
2.54.0