Skip to contentSkip to conversation

scsi: qla2xxx: Remove redundant and conflicting initialization in qlt_alloc_qfull_cmd

PATCH New Jiasheng Jiang 1 participant 1 message Jan 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qla2xxx: Remove redundant and conflicting initialization in qlt_alloc_qfull_cmd

Remove the unconditional initialization of cmd->q_full = 1 at the beginning of qlt_alloc_qfull_cmd().

Perform initialization of the q_full and term_exchg flags exclusively within the conditional branches based on the qfull input parameter. This change eliminates the redundant assignment when qfull is true and avoids the unnecessary overwrite of the flag when qfull is false.

Ensure that the command state accurately and explicitly reflects its intended purpose—either a "Queue Full" event or an "Exchange Termination" —without relying on a conflicting default value.

Fixes 33e799775593 ("qla2xxx: Add support for QFull throttling and Term Exchange retry")
---
 drivers/scsi/qla2xxx/qla_target.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +3 -2
index d772136984c9..560ff42ce3c7 100644
@@ -6682,7 +6682,6 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
 	cmd->tgt = vha->vha_tgt.qla_tgt;
 	cmd->vha = vha;
 	cmd->reset_count = ha->base_qpair->chip_reset;
-	cmd->q_full = 1;
 	cmd->qpair = ha->base_qpair;
 	cmd->cdb = &cmd->atio.u.isp24.fcp_cmnd.cdb[0];
 	cmd->cdb_len = 16;
@@ -6691,8 +6690,10 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
 		cmd->q_full = 1;
 		/* NOTE: borrowing the state field to carry the status */
 		cmd->state = status;
-	} else
+	} else {
+		cmd->q_full = 0;
 		cmd->term_exchg = 1;
+	}
 
 	spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags);
 	list_add_tail(&cmd->cmd_list, &vha->hw->tgt.q_full_list);
Signature · 1 line
2.25.1