Skip to contentSkip to conversation

ib_srpt: Remove redundant assignment to ret

PATCH Applied Yang Li 4 participants 4 messages May 6, 2021 – May 11, 2021

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 ib_srpt: Remove redundant assignment to ret

Variable 'ret' is set to -ENOMEM but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed

In 'commit b79fafac70fc ("target: make queue_tm_rsp() return void")' srpt_queue_response() has been changed to return void, so after "goto out", there is no need to return ret.

Clean up the following clang-analyzer warning:

drivers/infiniband/ulp/srpt/ib_srpt.c:2860:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]

---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 1 -
 1 file changed, 1 deletion(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +0 -1
index ea44780..3cadf12 100644
@@ -2858,7 +2858,6 @@ static void srpt_queue_response(struct se_cmd *cmd)
 			&ch->sq_wr_avail) < 0)) {
 		pr_warn("%s: IB send queue full (needed %d)\n",
 				__func__, ioctx->n_rdma);
-		ret = -ENOMEM;
 		goto out;
 	}
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Yang Li

Variable 'ret' is set to -ENOMEM but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed

In 'commit b79fafac70fc ("target: make queue_tm_rsp() return void")' srpt_queue_response() has been changed to return void, so after "goto out", there is no need to return ret.

Clean up the following clang-analyzer warning:

Quoted 9 lines

drivers/infiniband/ulp/srpt/ib_srpt.c:2860:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]

---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 1 -
 1 file changed, 1 deletion(-)
Fixes b99f8e4d7bcd ("IB/srpt: convert to the generic RDMA READ/WRITE API")

Thanks,

maintainer Reviewed-by
#2 lore raw
Quoted 21 lines · Leon Romanovsky
Quoted 10 lines · Yang Li

Variable 'ret' is set to -ENOMEM but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed

In 'commit b79fafac70fc ("target: make queue_tm_rsp() return void")' srpt_queue_response() has been changed to return void, so after "goto out", there is no need to return ret.

Clean up the following clang-analyzer warning:

Quoted 9 lines

drivers/infiniband/ulp/srpt/ib_srpt.c:2860:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]

---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 4 lines
Fixes b99f8e4d7bcd ("IB/srpt: convert to the generic RDMA READ/WRITE API")

Thanks,

Reverting commit b99f8e4d7bcd and handling queue_*_rsp() errors in the LIO core probably would be a better approach. Anyway:

maintainer Applied
#3 lore raw
In reply to Yang Li
Quoted 13 lines · Yang Li

Variable 'ret' is set to -ENOMEM but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed

In 'commit b79fafac70fc ("target: make queue_tm_rsp() return void")' srpt_queue_response() has been changed to return void, so after "goto out", there is no need to return ret.

Clean up the following clang-analyzer warning:

drivers/infiniband/ulp/srpt/ib_srpt.c:2860:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]

Quoted 7 lines
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 1 -
 1 file changed, 1 deletion(-)

Applied to for-next

Thanks,
Jason