2019-09-05 14:43:24

by Colin King

[permalink] [raw]
Subject: [PATCH] nvme: tcp: remove redundant assignment to variable ret

From: Colin Ian King <[email protected]>

The variable ret is being initialized with a value that is never read
and is being re-assigned immediately afterwards. The assignment is
redundant and hence can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/nvme/host/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 2d8ba31cb691..d91be6ddfe25 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1824,7 +1824,7 @@ static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
{
struct nvmf_ctrl_options *opts = ctrl->opts;
- int ret = -EINVAL;
+ int ret;

ret = nvme_tcp_configure_admin_queue(ctrl, new);
if (ret)
--
2.20.1


2019-09-05 19:42:25

by Max Gurtovoy

[permalink] [raw]
Subject: Re: [PATCH] nvme: tcp: remove redundant assignment to variable ret


On 9/5/2019 5:34 PM, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> The variable ret is being initialized with a value that is never read
> and is being re-assigned immediately afterwards. The assignment is
> redundant and hence can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/nvme/host/tcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 2d8ba31cb691..d91be6ddfe25 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1824,7 +1824,7 @@ static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
> static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
> {
> struct nvmf_ctrl_options *opts = ctrl->opts;
> - int ret = -EINVAL;
> + int ret;
>
> ret = nvme_tcp_configure_admin_queue(ctrl, new);
> if (ret)

Looks fine,

Reviewed-by: Max Gurtovoy <[email protected]>