Skip to contentSkip to conversation

target: Simplify transport_generic_free_cmd() (1/2)

PATCH In review Bart Van Assche 1 participant 1 message Mar 1, 2018 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH 8/14 target: Simplify transport_generic_free_cmd() (1/2)

Move identical code outside an if/else statement. This patch does not change any functionality.

Cc Hannes Reinecke <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Mike Christie <[email protected]>
---
 drivers/target/target_core_transport.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/target/target_core_transport.c +2 -6
index 7eb55e6b5831..92682400995e 100644
@@ -2602,9 +2602,6 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
 	if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) {
 		if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
 			target_wait_free_cmd(cmd, &aborted, &tas);
-
-		if (!aborted || tas)
-			ret = target_put_sess_cmd(cmd);
 	} else {
 		if (wait_for_tasks)
 			target_wait_free_cmd(cmd, &aborted, &tas);
@@ -2618,10 +2615,9 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
 
 		if (cmd->se_lun)
 			transport_lun_remove_cmd(cmd);
-
-		if (!aborted || tas)
-			ret = target_put_sess_cmd(cmd);
 	}
+	if (!aborted || tas)
+		ret = target_put_sess_cmd(cmd);
 	if (aborted) {
 		pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag);
 		wait_for_completion(&cmd->cmd_wait_comp);
Signature · 1 line
2.16.2