Re: [PATCH 1/5] i3c: master: Release the fwnode of i2c boardinfo
Adrian Hunter <[email protected]>
| Newsgroups | org.infradead.lists.linux-i3c,org.kernel.vger.linux-kernel |
|---|---|
| Organization | Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki |
| Message-ID | <[email protected]> |
On 04/08/2026 13:12, Akhil R wrote:
> i3c_master_add_i2c_boardinfo() takes a reference on the firmware node of
> every i2c child described for the bus, but nothing ever drops it. The i2c
> core takes a reference of its own for the client that it creates, so this
> one is never consumed. The nodes stay pinned for as long as the system
> runs, and more references are leaked on every rebind of the controller
> driver and on every failed probe.
>
> Drop the reference with a device managed action on the controller device,
> next to where it is taken.
>
> Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
> Reported-by: Adrian Hunter <[email protected]>
> Closes: https://lore.kernel.org/all/[email protected]/
> Assisted-by: Cursor:claude-opus-5
> Signed-off-by: Akhil R <[email protected]>
Cosmetic suggestion below, nevertheless:
Reviewed-by: Adrian Hunter <[email protected]>
> ---
> drivers/i3c/master.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index f485b98805cf..08dc10f172aa 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2871,6 +2871,11 @@ static inline int i3c_acpi_add_i2c_boardinfo(struct i2c_dev_boardinfo *boardinfo
> }
> #endif
>
> +static void i3c_master_put_boardinfo_fwnode(void *fwnode)
> +{
> + fwnode_handle_put(fwnode);
> +}
> +
> static int
> i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master,
> struct fwnode_handle *fwnode, u32 *reg)
> @@ -2913,7 +2918,8 @@ i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master,
> list_add_tail(&boardinfo->node, &master->boardinfo.i2c);
> fwnode_handle_get(fwnode);
>
> - return 0;
> + return devm_add_action_or_reset(dev, i3c_master_put_boardinfo_fwnode,
> + fwnode);
I'd suggest wrapping at 100 cols rather than 80.
> }
>
> static int
--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c