Skip to contentSkip to conversation

scsi: qla2xxx: remove setting of 'req' and 'rsp' parameter

PATCH Applied Tom Rix 3 participants 3 messages May 21, 2022 – Jun 2, 2022

Subsystems (2)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 scsi: qla2xxx: remove setting of 'req' and 'rsp' parameter

cppcheck reports
[drivers/scsi/qla2xxx/qla_mid.c:594]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [drivers/scsi/qla2xxx/qla_mid.c:620]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?

The functions qla25xx_free_req_que and qla25xx_free_rsp_que are similar. They free a 'req' and a 'rsp' parameter respectively. The last statement of both functions is setting the parameter to NULL. This has no effect and can be removed.

---
 drivers/scsi/qla2xxx/qla_mid.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/qla2xxx/qla_mid.c +0 -2
index e6b5c4ccce97..346d47b61c07 100644
@@ -591,7 +591,6 @@ qla25xx_free_req_que(struct scsi_qla_host *vha, struct req_que *req)
 	}
 	kfree(req->outstanding_cmds);
 	kfree(req);
-	req = NULL;
 }
 
 static void
@@ -617,7 +616,6 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
 		mutex_unlock(&ha->vport_lock);
 	}
 	kfree(rsp);
-	rsp = NULL;
 }
 
 int
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 37 lines · Tom Rix

cppcheck reports
[drivers/scsi/qla2xxx/qla_mid.c:594]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [drivers/scsi/qla2xxx/qla_mid.c:620]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?

The functions qla25xx_free_req_que and qla25xx_free_rsp_que are similar. They free a 'req' and a 'rsp' parameter respectively. The last statement of both functions is setting the parameter to NULL. This has no effect and can be removed.

---
drivers/scsi/qla2xxx/qla_mid.c | 2 --

1 file changed, 2 deletions(-)
drivers/scsi/qla2xxx/qla_mid.c +0 -1
index e6b5c4ccce97..346d47b61c07 100644
@@ -591,7 +591,6 @@ qla25xx_free_req_que(struct scsi_qla_host *vha, struct req_que *req)
 	}
 	kfree(req->outstanding_cmds);
 	kfree(req);
-	req = NULL;
 }
 

static void

drivers/scsi/qla2xxx/qla_mid.c +0 -1
@@ -617,7 +616,6 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
 		mutex_unlock(&ha->vport_lock);
 	}
 	kfree(rsp);
-	rsp = NULL;
 }
 
Quoted 4 lines

int

Signature · 1 line
2.27.0

--
Himanshu Madhani Oracle Linux Engineering

#2 lore raw
In reply to Tom Rix

Tom,

Quoted 4 lines

The functions qla25xx_free_req_que and qla25xx_free_rsp_que are similar. They free a 'req' and a 'rsp' parameter respectively. The last statement of both functions is setting the parameter to NULL. This has no effect and can be removed.

Applied to 5.19/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering