2021-05-13 19:19:56

by Colin King

[permalink] [raw]
Subject: [PATCH] nvme: remove redundant initialization of variable ret

From: Colin Ian King <[email protected]>

The variable ret is being initialized with a value that is never read,
it is being updated later on. The assignment is redundant and can be
removed.

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

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 37943dc4c2c1..74bf2c7f2b80 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1088,7 +1088,7 @@ static void nvme_rdma_reconnect_or_remove(struct nvme_rdma_ctrl *ctrl)

static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)
{
- int ret = -EINVAL;
+ int ret;
bool changed;

ret = nvme_rdma_configure_admin_queue(ctrl, new);
--
2.30.2



2021-05-14 09:19:39

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH] nvme: remove redundant initialization of variable ret


> On May 13, 2021, at 5:08 AM, Colin King <[email protected]> wrote:
>
> - int ret = -EINVAL;
> + int ret;
> bool changed;

It'd be nice to move ret declaration after book changed.



2021-05-19 19:19:38

by Christoph Hellwig

[permalink] [raw]