[PATCH] i3c: Move device name assignment after i3c_bus_init

Billy Tsai posted 1 patch 3 weeks, 5 days ago
drivers/i3c/master.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] i3c: Move device name assignment after i3c_bus_init
Posted by Billy Tsai 3 weeks, 5 days ago
Move device name initialization to occur after i3c_bus_init()
so that i3cbus->id is guaranteed to be assigned before it is used.

Fixes: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 drivers/i3c/master.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 7f606c871648..1bc3c9068402 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2881,7 +2881,6 @@ int i3c_master_register(struct i3c_master_controller *master,
 	INIT_LIST_HEAD(&master->boardinfo.i3c);
 
 	device_initialize(&master->dev);
-	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
 
 	master->dev.dma_mask = parent->dma_mask;
 	master->dev.coherent_dma_mask = parent->coherent_dma_mask;
@@ -2891,6 +2890,8 @@ int i3c_master_register(struct i3c_master_controller *master,
 	if (ret)
 		goto err_put_dev;
 
+	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
+
 	ret = of_populate_i3c_bus(master);
 	if (ret)
 		goto err_put_dev;

---
base-commit: 9c7ef209cd0f7c1a92ed61eed3e835d6e4abc66c
change-id: 20260112-upstream_i3c_fix-455a2cc442a5

Best regards,
-- 
Billy Tsai <billy_tsai@aspeedtech.com>
Re: [PATCH] i3c: Move device name assignment after i3c_bus_init
Posted by Alexandre Belloni 3 weeks, 3 days ago
On Mon, 12 Jan 2026 14:07:22 +0800, Billy Tsai wrote:
> Move device name initialization to occur after i3c_bus_init()
> so that i3cbus->id is guaranteed to be assigned before it is used.
> 
> 

Applied, thanks!

[1/1] i3c: Move device name assignment after i3c_bus_init
      https://git.kernel.org/i3c/c/3502cea99c7c

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Re: [PATCH] i3c: Move device name assignment after i3c_bus_init
Posted by Frank Li 3 weeks, 5 days ago
On Mon, Jan 12, 2026 at 02:07:22PM +0800, Billy Tsai wrote:
> Move device name initialization to occur after i3c_bus_init()
> so that i3cbus->id is guaranteed to be assigned before it is used.
>
> Fixes: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/i3c/master.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 7f606c871648..1bc3c9068402 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2881,7 +2881,6 @@ int i3c_master_register(struct i3c_master_controller *master,
>  	INIT_LIST_HEAD(&master->boardinfo.i3c);
>
>  	device_initialize(&master->dev);
> -	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
>
>  	master->dev.dma_mask = parent->dma_mask;
>  	master->dev.coherent_dma_mask = parent->coherent_dma_mask;
> @@ -2891,6 +2890,8 @@ int i3c_master_register(struct i3c_master_controller *master,
>  	if (ret)
>  		goto err_put_dev;
>
> +	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
> +
>  	ret = of_populate_i3c_bus(master);
>  	if (ret)
>  		goto err_put_dev;
>
> ---
> base-commit: 9c7ef209cd0f7c1a92ed61eed3e835d6e4abc66c
> change-id: 20260112-upstream_i3c_fix-455a2cc442a5
>
> Best regards,
> --
> Billy Tsai <billy_tsai@aspeedtech.com>
>