[PATCH RFC 01/11] nvmet: Remove duplicate uuid_copy

Damien Le Moal dlemoal at kernel.org
Thu Mar 13 01:59:16 PDT 2025


On 3/13/25 14:18, Mike Christie wrote:
> We do uuid_copy twice in nvmet_alloc_ctrl so this patch deletes one
> of the calls.
> 
> Signed-off-by: Mike Christie <michael.christie at oracle.com>
> ---
>  drivers/nvme/target/core.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 2e741696f371..f896d1fd3326 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -1618,8 +1618,6 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args)
>  	}
>  	ctrl->cntlid = ret;
>  
> -	uuid_copy(&ctrl->hostid, args->hostid);

Good catch. But it is the other call that should be removed as that will also
remove the if (args->hostid) as that is not needed (the 2 call sites of
nvmet_alloc_ctrl() both set a hostid).

And maybe sned this patch as a real patch as I think it can go upstream now.

> -
>  	/*
>  	 * Discovery controllers may use some arbitrary high value
>  	 * in order to cleanup stale discovery sessions


-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list