Skip to contentSkip to conversation

scsi: qedf: Remove dead code

PATCH Applied Liao Chen 3 participants 3 messages Sep 21, 2024 – Oct 4, 2024

Subsystems (2)
lore
Share & tools
lore

Liao Chen

author
#0 lore raw

PATCH v2 1/1 scsi: qedf: Remove dead code

If container_of() is used correctly, its result is never NULL. Remove the code that depends on container_of() returning a NULL pointer.

---
 drivers/scsi/qedf/qedf_main.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/scsi/qedf/qedf_main.c +0 -5
index cf13148ba281..df756f3eef3e 100644
@@ -4018,11 +4018,6 @@ void qedf_stag_change_work(struct work_struct *work)
 	struct qedf_ctx *qedf =
 	    container_of(work, struct qedf_ctx, stag_work.work);
 
-	if (!qedf) {
-		QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
-		return;
-	}
-
 	if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) {
 		QEDF_ERR(&qedf->dbg_ctx,
 			 "Already is in recovery, hence not calling software context reset.\n");
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 14 lines · Liao Chen

If container_of() is used correctly, its result is never NULL. Remove the code that depends on container_of() returning a NULL pointer.

---
  drivers/scsi/qedf/qedf_main.c | 5 -----
  1 file changed, 5 deletions(-)
drivers/scsi/qedf/qedf_main.c +0 -0
index cf13148ba281..df756f3eef3e 100644
@@ -4018,11 +4018,6 @@ void qedf_stag_change_work(struct work_struct *work)
  	struct qedf_ctx *qedf =

drivers/scsi/qedf/qedf_main.c void qedf_stag_change_work(struct work_struct *work) · line 4023

Quoted 10 lines
drivers/scsi/qedf/qedf_main.c +0 -5
  	    container_of(work, struct qedf_ctx, stag_work.work);
 
-	if (!qedf) {
-		QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
-		return;
-	}
-
  	if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) {
  		QEDF_ERR(&qedf->dbg_ctx,
  			 "Already is in recovery, hence not calling software context reset.\n");

The merge window is open so this is not the best time to send patches that are not fixes for issues discovered during the merge window. Anyway:

#2 lore raw
In reply to Liao Chen

Liao,

Quoted 2 lines

If container_of() is used correctly, its result is never NULL. Remove the code that depends on container_of() returning a NULL pointer.

Applied to 6.13/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering