From: Adrian Hunter <adrian.hunter@intel.com>
To: Akhil R <akhilrajeev@nvidia.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Frank Li <Frank.Li@nxp.com>, <linux-i3c@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Cc: Sashiko AI review <sashiko-bot@kernel.org>
Subject: Re: [PATCH 3/5] i3c: master: Do not release the addresses when reattach fails
Date: Tue, 4 Aug 2026 20:56:43 +0300 [thread overview]
Message-ID: <1563b862-9263-49a7-a04c-631a39aa48a6@intel.com> (raw)
In-Reply-To: <20260804101301.2975911-4-akhilrajeev@nvidia.com>
On 04/08/2026 13:12, Akhil R wrote:
> i3c_master_reattach_i3c_dev_locked() releases the address slots of the
> device when the controller callback fails, even though the target keeps
> responding to its dynamic address on the bus.
>
> i3c_master_early_i3c_dev_add() cannot take that address back afterwards.
> It jumps to err_rstdaa to reset the target, but i3c_master_rstdaa_locked()
> only accepts an address that is marked as assigned. It rejects the request
> with -EINVAL and sends no CCC, leaving the target responding to an address
> that the core considers free and hands out during dynamic address
> assignment.
>
> i3c_master_reconcile_dyn_addrs() ignores the return value, so the device
i3c_master_reconcile_dyn_addrs() doesn't call i3c_master_reattach_i3c_dev_locked()
but __i3c_master_add_i3c_dev_locked() does.
> stays attached and in the bus list at the address that SETNEWDA just
> assigned to it, while the core is free to give the same address to another
> device.
>
> Leave the address slots to the callers. Those that cannot use the device
> any longer detach it, which releases the slots in
> i3c_master_detach_i3c_dev().
>
> No in-tree controller fails its ->reattach_i3c_dev callback today, so
> there is no known trigger for this. It is a robustness fix for the error
> path only.
>
> Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
> Reported-by: Sashiko AI review <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/all/20260721043058.C02B31F000E9@smtp.kernel.org/
> Assisted-by: Cursor:claude-opus-5
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
> drivers/i3c/master.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 568788e4cdb5..23557ca2df68 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -1944,10 +1944,8 @@ int i3c_master_reattach_i3c_dev_locked(struct i3c_dev_desc *dev,
>
> if (master->ops->reattach_i3c_dev) {
> ret = master->ops->reattach_i3c_dev(dev, old_dyn_addr);
> - if (ret) {
> - i3c_master_put_i3c_addrs(dev);
> + if (ret)
> return ret;
> - }
> }
That becomes just:
if (master->ops->reattach_i3c_dev)
return master->ops->reattach_i3c_dev(dev, old_dyn_addr);
and 'ret' goes away.
>
> return 0;
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2026-08-04 17:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 10:12 [PATCH 0/5] i3c: Fix firmware node refcounting and error paths Akhil R
2026-08-04 10:12 ` [PATCH 1/5] i3c: master: Release the fwnode of i2c boardinfo Akhil R
2026-08-04 10:33 ` sashiko-bot
2026-08-05 19:07 ` Frank Li
2026-08-04 16:53 ` Adrian Hunter
2026-08-04 10:12 ` [PATCH 2/5] i3c: master: Fix refcount of i3c fwnode Akhil R
2026-08-04 16:53 ` Adrian Hunter
2026-08-04 10:12 ` [PATCH 3/5] i3c: master: Do not release the addresses when reattach fails Akhil R
2026-08-04 17:56 ` Adrian Hunter [this message]
2026-08-04 10:13 ` [PATCH 4/5] i3c: dw: Do not use OF match data as a quirk bitmask Akhil R
2026-08-04 11:04 ` sashiko-bot
2026-08-05 19:53 ` Frank Li
2026-08-04 10:13 ` [PATCH 5/5] i3c: dw: Resume the controller before unregistering the bus Akhil R
2026-08-04 11:15 ` sashiko-bot
2026-08-05 19:57 ` Frank Li
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=1563b862-9263-49a7-a04c-631a39aa48a6@intel.com \
--to=adrian.hunter@intel.com \
--cc=Frank.Li@nxp.com \
--cc=akhilrajeev@nvidia.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sashiko-bot@kernel.org \
/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