[PATCH 3/5] nvmet: Remove redundant assignment of error code in nvmet_ns_enable()

Randy Dunlap rdunlap at infradead.org
Mon Jun 23 13:45:31 PDT 2025



On 6/22/25 11:40 PM, Alok Tiwari wrote:
> removing the unnecessary ret = -EMFILE; assignment since it is
> immediately overwritten by the result of nvmet_bdev_ns_enable()
> The initial value(-EMFILE) is redundant because it has no effect
> on the code logic or outcome.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari at oracle.com>

Reviewed-by: Randy Dunlap <rdunlap at infradead.org>

Thanks.

> ---
>  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 175c5b6d4dd58..884286f90688a 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -581,8 +581,6 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	if (ns->enabled)
>  		goto out_unlock;
>  
> -	ret = -EMFILE;
> -
>  	ret = nvmet_bdev_ns_enable(ns);
>  	if (ret == -ENOTBLK)
>  		ret = nvmet_file_ns_enable(ns);

-- 
~Randy



More information about the Linux-nvme mailing list