[PATCH] nvme-fabrics: remove unneeded variable

cgel.zte@gmail.com posted 1 patch 4 years, 5 months ago
drivers/nvme/host/fabrics.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] nvme-fabrics: remove unneeded variable
Posted by cgel.zte@gmail.com 4 years, 5 months ago
From: Changcheng Deng <deng.changcheng@zte.com.cn>

Remove unneeded variable used to store return value.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
---
 drivers/nvme/host/fabrics.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 7ae041e2b3fb..f79a66d4e22c 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -1092,7 +1092,6 @@ static void __nvmf_concat_opt_tokens(struct seq_file *seq_file)
 static int nvmf_dev_show(struct seq_file *seq_file, void *private)
 {
 	struct nvme_ctrl *ctrl;
-	int ret = 0;
 
 	mutex_lock(&nvmf_dev_mutex);
 	ctrl = seq_file->private;
@@ -1106,7 +1105,7 @@ static int nvmf_dev_show(struct seq_file *seq_file, void *private)
 
 out_unlock:
 	mutex_unlock(&nvmf_dev_mutex);
-	return ret;
+	return 0;
 }
 
 static int nvmf_dev_open(struct inode *inode, struct file *file)
-- 
2.25.1

Re: [PATCH] nvme-fabrics: remove unneeded variable
Posted by Sagi Grimberg 4 years, 5 months ago
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
> 
> Remove unneeded variable used to store return value.

I actually think that ret is missing an assignment in the error
case (e.g ret = -ENODEV)...

> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
> ---
>   drivers/nvme/host/fabrics.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index 7ae041e2b3fb..f79a66d4e22c 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -1092,7 +1092,6 @@ static void __nvmf_concat_opt_tokens(struct seq_file *seq_file)
>   static int nvmf_dev_show(struct seq_file *seq_file, void *private)
>   {
>   	struct nvme_ctrl *ctrl;
> -	int ret = 0;
>   
>   	mutex_lock(&nvmf_dev_mutex);
>   	ctrl = seq_file->private;
> @@ -1106,7 +1105,7 @@ static int nvmf_dev_show(struct seq_file *seq_file, void *private)
>   
>   out_unlock:
>   	mutex_unlock(&nvmf_dev_mutex);
> -	return ret;
> +	return 0;
>   }
>   
>   static int nvmf_dev_open(struct inode *inode, struct file *file)
> 
Re: [PATCH] nvme-fabrics: remove unneeded variable
Posted by Christoph Hellwig 4 years, 5 months ago
Thanks,

applied to nvme-5.17.