From: Leon Romanovsky <leon@kernel.org>
To: Chenguang Zhao <zhaochenguang@kylinos.cn>
Cc: "Jason Gunthorpe" <jgg@ziepe.ca>,
"Sean Hefty" <shefty@nvidia.com>,
"Håkon Bugge" <haakon.bugge@oracle.com>,
"Vlad Dumitrescu" <vdumitrescu@nvidia.com>,
"Marco Crivellari" <marco.crivellari@suse.com>,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH] IB/cm: unregister client groups when port registration fails in cm_add_one
Date: Thu, 14 May 2026 09:47:46 +0300 [thread overview]
Message-ID: <20260514064746.GL15586@unreal> (raw)
In-Reply-To: <20260511103204.1757106-1-zhaochenguang@kylinos.cn>
On Mon, May 11, 2026 at 06:32:04PM +0800, Chenguang Zhao wrote:
> 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.
Why? There is no need to call ib_port_unregister_client_groups() for the
current port. A failure in ib_port_register_client_groups() does not create
any sysfs groups that would require cleanup.
Thanks
>
> 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
>
>
prev parent reply other threads:[~2026-05-14 6:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260514064746.GL15586@unreal \
--to=leon@kernel.org \
--cc=haakon.bugge@oracle.com \
--cc=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=marco.crivellari@suse.com \
--cc=shefty@nvidia.com \
--cc=vdumitrescu@nvidia.com \
--cc=zhaochenguang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox