[PATCH 4/4] target: move common check into core_scsi3_check_cdb_abort_and_preempt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No point having three copies of it.

Signed-off-by: Joern Engel <joern@xxxxxxxxx>
---
 drivers/target/target_core_tmr.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 3bb317c..5b9ec98 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -105,6 +105,8 @@ static int core_scsi3_check_cdb_abort_and_preempt(
 {
 	struct t10_pr_registration *pr_reg, *pr_reg_tmp;
 
+	if (!preempt_and_abort_list)
+		return 0;
 	list_for_each_entry_safe(pr_reg, pr_reg_tmp, preempt_and_abort_list,
 				pr_reg_abort_list) {
 		if (pr_reg->pr_res_key == cmd->pr_res_key)
@@ -145,9 +147,8 @@ static void core_tmr_drain_tmr_list(
 		 * parameter (eg: for PROUT PREEMPT_AND_ABORT service action
 		 * skip non regisration key matching TMRs.
 		 */
-		if (preempt_and_abort_list &&
-		    (core_scsi3_check_cdb_abort_and_preempt(
-					preempt_and_abort_list, cmd) != 0))
+		if (core_scsi3_check_cdb_abort_and_preempt(
+					preempt_and_abort_list, cmd))
 			continue;
 		
 		spin_lock(&cmd->t_state_lock);
@@ -224,9 +225,8 @@ static void core_tmr_drain_task_list(
 		 * For PREEMPT_AND_ABORT usage, only process commands
 		 * with a matching reservation key.
 		 */
-		if (preempt_and_abort_list &&
-		    (core_scsi3_check_cdb_abort_and_preempt(
-					preempt_and_abort_list, cmd) != 0))
+		if (core_scsi3_check_cdb_abort_and_preempt(
+					preempt_and_abort_list, cmd))
 			continue;
 		/*
 		 * Not aborting PROUT PREEMPT_AND_ABORT CDB..
@@ -334,9 +334,8 @@ static void core_tmr_drain_cmd_list(
 		 * For PREEMPT_AND_ABORT usage, only process commands
 		 * with a matching reservation key.
 		 */
-		if (preempt_and_abort_list &&
-		    (core_scsi3_check_cdb_abort_and_preempt(
-					preempt_and_abort_list, cmd) != 0))
+		if (core_scsi3_check_cdb_abort_and_preempt(
+					preempt_and_abort_list, cmd))
 			continue;
 		/*
 		 * Not aborting PROUT PREEMPT_AND_ABORT CDB..
-- 
1.7.7.1

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux