[PATCH 1/5] i3c: master: Release the fwnode of i2c boardinfo
Adrian Hunter
adrian.hunter at intel.com
Tue Aug 4 09:53:03 PDT 2026
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 <adrian.hunter at intel.com>
> Closes: https://lore.kernel.org/all/97465893-3650-4f37-98b7-1db76fc6fd03@intel.com/
> Assisted-by: Cursor:claude-opus-5
> Signed-off-by: Akhil R <akhilrajeev at nvidia.com>
Cosmetic suggestion below, nevertheless:
Reviewed-by: Adrian Hunter <adrian.hunter at intel.com>
> ---
> 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
More information about the linux-i3c
mailing list