[PATCH 05/24] target: Remove unneeded test of se_cmd

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

 



From: Roland Dreier <rolandd@xxxxxxxxx>

se_cmd is dereferenced unconditionally in many other parts of
transport_get_lun_for_cmd() so remove the last test whether se_cmd is NULL.

Signed-off-by: Roland Dreier <rolandd@xxxxxxxxx>
Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
(cherry picked from commit 04763c76c8ea7ecea5c59ff80f076d6285a5b756)
(cherry picked from commit 722a630caa116fd5e51c31baba8dae662c0d1221)
---
 drivers/target/target_core_device.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 317ce58..d94933d 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -69,21 +69,17 @@ int transport_get_lun_for_cmd(
 	deve = se_cmd->se_deve =
 			&SE_NODE_ACL(se_sess)->device_list[unpacked_lun];
 	if (deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS) {
-		if (se_cmd) {
-			deve->total_cmds++;
-			deve->total_bytes += se_cmd->data_length;
-
-			if (se_cmd->data_direction == DMA_TO_DEVICE) {
-				if (deve->lun_flags &
-						TRANSPORT_LUNFLAGS_READ_ONLY) {
-					read_only = 1;
-					goto out;
-				}
-				deve->write_bytes += se_cmd->data_length;
-			} else if (se_cmd->data_direction ==
-				   DMA_FROM_DEVICE) {
-				deve->read_bytes += se_cmd->data_length;
+		deve->total_cmds++;
+		deve->total_bytes += se_cmd->data_length;
+
+		if (se_cmd->data_direction == DMA_TO_DEVICE) {
+			if (deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY) {
+				read_only = 1;
+				goto out;
 			}
+			deve->write_bytes += se_cmd->data_length;
+		} else if (se_cmd->data_direction == DMA_FROM_DEVICE) {
+			deve->read_bytes += se_cmd->data_length;
 		}
 		deve->deve_cmds++;
 
-- 
1.7.3.5

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux