Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] IB/cm: unregister client groups when port registration fails in cm_add_one
@ 2026-05-11 10:32 Chenguang Zhao
  2026-05-14  6:47 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2026-05-11 10:32 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: Chenguang Zhao, Sean Hefty, Håkon Bugge, Vlad Dumitrescu,
	Marco Crivellari, linux-rdma

If ib_port_register_client_groups() fails, jumping to error1 skips
ib_port_unregister_client_groups() for the current port because the
cleanup loop only runs for strictly smaller port indices after --i.
So jump to error2 to unregister the currently failed port.

Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
 drivers/infiniband/core/cm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 6ab9a0aee1ec..bcd347c78376 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -4378,7 +4378,7 @@ static int cm_add_one(struct ib_device *ib_device)
 		ret = ib_port_register_client_groups(ib_device, i,
 						     cm_counter_groups);
 		if (ret)
-			goto error1;
+			goto error2;
 
 		port->mad_agent = ib_register_mad_agent(ib_device, i,
 							IB_QPT_GSI,
-- 
2.25.1


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

end of thread, other threads:[~2026-05-14  6:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 10:32 [PATCH] IB/cm: unregister client groups when port registration fails in cm_add_one Chenguang Zhao
2026-05-14  6:47 ` Leon Romanovsky

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