[PATCH rdma-next 00/13] RDMA/hfi1: Make init_one() a sane counterpart of remove_one()

From: Leon Romanovsky

Date: Wed Jul 08 2026 - 06:50:55 EST


The hfi1 PCI probe path, init_one(), has accumulated years of ad-hoc
error handling that no longer matches how a driver probe is expected to
look. Rather than unwinding each initialization step as it fails, it
allocated hfi1_devdata up front, ran every stage, and then funneled two
unrelated failure values (initfail and ret) into one combined cleanup
block. That block kept the device half-alive "so diags can be used",
created the character device only to remove it again, flushed a global
workqueue the driver never queues onto, and diverged from the teardown
in remove_one() even though both release the same resources.

The result was hard to reason about and easy to break: a failing stage
released either too little (leaks) or ran cleanup for resources that were
never set up. Two real leaks were hiding in there, one of which was
reported in the mailing list.

Thanks

Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
---
Leon Romanovsky (13):
RDMA/rvt: Return NULL after port allocation failure
RDMA/hfi1: Preserve unit 0 on allocation failure
RDMA/hfi1: Remove redundant PCI device ID validation
RDMA/hfi1: Pass PCI device to hfi1_pcie_init()
RDMA/hfi1: Drop device data from hfi1_validate_rcvhdrcnt()
RDMA/hfi1: Create workqueues before device initialization
RDMA/hfi1: Free RX data on late probe failure
RDMA/hfi1: Allocate device data after PCI initialization
RDMA/hfi1: Remove redundant NULL checks in create_workqueues()
RDMA/hfi1: Stop flushing the global IB workqueue
RDMA/hfi1: Defer device creation until probe succeeds
RDMA/hfi1: Initialize debugfs after probe completes
RDMA/hfi1: Align probe error unwinding with device removal

drivers/infiniband/hw/hfi1/chip.c | 21 ++---
drivers/infiniband/hw/hfi1/chip.h | 2 +-
drivers/infiniband/hw/hfi1/hfi.h | 4 +-
drivers/infiniband/hw/hfi1/init.c | 194 +++++++++++++++-----------------------
drivers/infiniband/hw/hfi1/pcie.c | 32 ++++---
drivers/infiniband/sw/rdmavt/vt.c | 4 +-
6 files changed, 108 insertions(+), 149 deletions(-)
---
base-commit: 5f9576c6734abca88a02db72c466e09d2eddf160
change-id: 20260707-clean-init-one-hfi1-e02835d239ad

Best regards,
--
Leon Romanovsky <leonro@xxxxxxxxxx>