[PATCH] nvmet: Remove unnecessary assignment to ret in nvmet_ns_enable()

Mohamed Khalfella posted 1 patch 2 months, 1 week ago
drivers/nvme/target/core.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] nvmet: Remove unnecessary assignment to ret in nvmet_ns_enable()
Posted by Mohamed Khalfella 2 months, 1 week ago
Commit 74d16965d7ac ("nvmet-loop: avoid using mutex in IO hotpath")
moved checking maximum number of namespaces in subsystem from
nvmet_ns_enable() to nvmet_ns_alloc(). The assignment to ret in
nvmet_ns_enable() is no longer needed, remove it.

Fixex: 74d16965d7ac ("nvmet-loop: avoid using mutex in IO hotpath")
Signed-off-by: Mohamed Khalfella <mkhalfella@purestorage.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 b6247e4afc9c..83f3d2f8ef2d 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);
-- 
2.49.1
Re: [PATCH] nvmet: Remove unnecessary assignment to ret in nvmet_ns_enable()
Posted by Christoph Hellwig 2 months, 1 week ago
On Fri, Jul 25, 2025 at 04:06:39PM -0700, Mohamed Khalfella wrote:
> Commit 74d16965d7ac ("nvmet-loop: avoid using mutex in IO hotpath")
> moved checking maximum number of namespaces in subsystem from
> nvmet_ns_enable() to nvmet_ns_alloc(). The assignment to ret in
> nvmet_ns_enable() is no longer needed, remove it.

This assignment already is gone in the current tree.
Re: [PATCH] nvmet: Remove unnecessary assignment to ret in nvmet_ns_enable()
Posted by Mohamed Khalfella 2 months, 1 week ago
On 2025-07-30 17:53:35 +0200, Christoph Hellwig wrote:
> On Fri, Jul 25, 2025 at 04:06:39PM -0700, Mohamed Khalfella wrote:
> > Commit 74d16965d7ac ("nvmet-loop: avoid using mutex in IO hotpath")
> > moved checking maximum number of namespaces in subsystem from
> > nvmet_ns_enable() to nvmet_ns_alloc(). The assignment to ret in
> > nvmet_ns_enable() is no longer needed, remove it.
> 
> This assignment already is gone in the current tree.
> 

Yep, it looks like it has been removed in commit 2e7dd5c1a8ae ("nvmet: remove
redundant assignment of error code in nvmet_ns_enable()").

Thanks,
Re: [PATCH] nvmet: Remove unnecessary assignment to ret in nvmet_ns_enable()
Posted by Nilay Shroff 2 months, 1 week ago

On 7/26/25 4:36 AM, Mohamed Khalfella wrote:
> Commit 74d16965d7ac ("nvmet-loop: avoid using mutex in IO hotpath")
> moved checking maximum number of namespaces in subsystem from
> nvmet_ns_enable() to nvmet_ns_alloc(). The assignment to ret in
> nvmet_ns_enable() is no longer needed, remove it.
> 
> Fixex: 74d16965d7ac ("nvmet-loop: avoid using mutex in IO hotpath")
> Signed-off-by: Mohamed Khalfella <mkhalfella@purestorage.com>

Looks good to me:
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>