Re: [PATCH V2 5/7] i3c: master: Make i3c_master_add_i3c_dev_locked() return void
From: Frank Li
Date: Mon Jun 08 2026 - 13:52:07 EST
On Mon, Jun 08, 2026 at 10:57:58AM +0300, Adrian Hunter wrote:
> The return value of i3c_master_add_i3c_dev_locked() is not used by any
> caller, and callers are not in a position to recover from failures in
> this path.
>
> Change the function to return void. Amend the kernel-doc accordingly,
> fix some grammar and remove a stale paragraph.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
>
>
> Changes in V2:
>
> Re-base due to changes in previous patches.
>
>
> drivers/i3c/master.c | 17 ++++-------------
> include/linux/i3c/master.h | 3 +--
> 2 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 7b60b0c7f646..57857a3351c7 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2324,19 +2324,12 @@ i3c_master_search_i3c_dev_duplicate(struct i3c_dev_desc *refdev)
> * @master: master used to send frames on the bus
> * @addr: I3C slave dynamic address assigned to the device
> *
> - * This function is instantiating an I3C device object and adding it to the
> - * I3C device list. All device information are automatically retrieved using
> - * standard CCC commands.
> - *
> - * The I3C device object is returned in case the master wants to attach
> - * private data to it using i3c_dev_set_master_data().
> + * This function instantiates an I3C device object and adds it to the I3C device
> + * list. All device information is retrieved using standard CCC commands.
> *
> * This function must be called with the bus lock held in write mode.
> - *
> - * Return: a 0 in case of success, an negative error code otherwise.
> */
> -int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
> - u8 addr)
> +void i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, u8 addr)
> {
> struct i3c_device_info info = { .dyn_addr = addr };
> struct i3c_dev_desc *newdev, *olddev;
> @@ -2460,7 +2453,7 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
> mutex_unlock(&newdev->ibi_lock);
> }
>
> - return 0;
> + return;
>
> err_detach_dev:
> if (newdev->dev && newdev->dev->desc)
> @@ -2480,8 +2473,6 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
> i3c_bus_set_addr_slot_status(&master->bus, addr, I3C_ADDR_SLOT_I3C_DEV);
>
> dev_err(&master->dev, "Failed to add I3C device at address %u, error %d\n", addr, ret);
> -
> - return ret;
> }
> EXPORT_SYMBOL_GPL(i3c_master_add_i3c_dev_locked);
>
> diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
> index e2c831fb5354..f73cede87d36 100644
> --- a/include/linux/i3c/master.h
> +++ b/include/linux/i3c/master.h
> @@ -615,8 +615,7 @@ int i3c_master_defslvs_locked(struct i3c_master_controller *master);
> int i3c_master_get_free_addr(struct i3c_master_controller *master,
> u8 start_addr);
>
> -int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
> - u8 addr);
> +void i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, u8 addr);
> int i3c_master_do_daa(struct i3c_master_controller *master);
> int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstdaa);
> struct i3c_dma *i3c_master_dma_map_single(struct device *dev, void *ptr,
> --
> 2.51.0
>