diff options
author | Jörn Engel <joern@logfs.org> | 2012-03-15 15:06:58 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-03-15 22:16:09 -0400 |
commit | 281689051a628e5341ce1efcfafde9d60f2f6fbb (patch) | |
tree | 15809410fe5d1c8540622f5bd7c726517b22ddd3 /drivers/target | |
parent | f2083241f23722207676025abbb45a301d412e69 (diff) |
target: remove obvious warnings
Get rid of a bunch of write-only variables. In a number of cases I
suspect actual bugs to be present, so I left all of those for a second
look.
(nab: fix lio-core patch fuzz)
Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 11 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 4 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_nego.c | 8 | ||||
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_configfs.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_device.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_pr.c | 9 | ||||
-rw-r--r-- | drivers/target/target_core_stat.c | 12 | ||||
-rw-r--r-- | drivers/target/target_core_tpg.c | 7 | ||||
-rw-r--r-- | drivers/target/tcm_fc/tfc_sess.c | 2 |
10 files changed, 6 insertions, 53 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index d3b54ecbfcda..b8fbc299d4ef 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -1469,14 +1469,12 @@ static int iscsit_handle_nop_out( | |||
1469 | unsigned char *ping_data = NULL; | 1469 | unsigned char *ping_data = NULL; |
1470 | int cmdsn_ret, niov = 0, ret = 0, rx_got, rx_size; | 1470 | int cmdsn_ret, niov = 0, ret = 0, rx_got, rx_size; |
1471 | u32 checksum, data_crc, padding = 0, payload_length; | 1471 | u32 checksum, data_crc, padding = 0, payload_length; |
1472 | u64 lun; | ||
1473 | struct iscsi_cmd *cmd = NULL; | 1472 | struct iscsi_cmd *cmd = NULL; |
1474 | struct kvec *iov = NULL; | 1473 | struct kvec *iov = NULL; |
1475 | struct iscsi_nopout *hdr; | 1474 | struct iscsi_nopout *hdr; |
1476 | 1475 | ||
1477 | hdr = (struct iscsi_nopout *) buf; | 1476 | hdr = (struct iscsi_nopout *) buf; |
1478 | payload_length = ntoh24(hdr->dlength); | 1477 | payload_length = ntoh24(hdr->dlength); |
1479 | lun = get_unaligned_le64(&hdr->lun); | ||
1480 | hdr->itt = be32_to_cpu(hdr->itt); | 1478 | hdr->itt = be32_to_cpu(hdr->itt); |
1481 | hdr->ttt = be32_to_cpu(hdr->ttt); | 1479 | hdr->ttt = be32_to_cpu(hdr->ttt); |
1482 | hdr->cmdsn = be32_to_cpu(hdr->cmdsn); | 1480 | hdr->cmdsn = be32_to_cpu(hdr->cmdsn); |
@@ -1686,13 +1684,11 @@ static int iscsit_handle_task_mgt_cmd( | |||
1686 | struct se_tmr_req *se_tmr; | 1684 | struct se_tmr_req *se_tmr; |
1687 | struct iscsi_tmr_req *tmr_req; | 1685 | struct iscsi_tmr_req *tmr_req; |
1688 | struct iscsi_tm *hdr; | 1686 | struct iscsi_tm *hdr; |
1689 | u32 payload_length; | ||
1690 | int out_of_order_cmdsn = 0; | 1687 | int out_of_order_cmdsn = 0; |
1691 | int ret; | 1688 | int ret; |
1692 | u8 function; | 1689 | u8 function; |
1693 | 1690 | ||
1694 | hdr = (struct iscsi_tm *) buf; | 1691 | hdr = (struct iscsi_tm *) buf; |
1695 | payload_length = ntoh24(hdr->dlength); | ||
1696 | hdr->itt = be32_to_cpu(hdr->itt); | 1692 | hdr->itt = be32_to_cpu(hdr->itt); |
1697 | hdr->rtt = be32_to_cpu(hdr->rtt); | 1693 | hdr->rtt = be32_to_cpu(hdr->rtt); |
1698 | hdr->cmdsn = be32_to_cpu(hdr->cmdsn); | 1694 | hdr->cmdsn = be32_to_cpu(hdr->cmdsn); |
@@ -2204,14 +2200,10 @@ static int iscsit_handle_snack( | |||
2204 | struct iscsi_conn *conn, | 2200 | struct iscsi_conn *conn, |
2205 | unsigned char *buf) | 2201 | unsigned char *buf) |
2206 | { | 2202 | { |
2207 | u32 unpacked_lun; | ||
2208 | u64 lun; | ||
2209 | struct iscsi_snack *hdr; | 2203 | struct iscsi_snack *hdr; |
2210 | 2204 | ||
2211 | hdr = (struct iscsi_snack *) buf; | 2205 | hdr = (struct iscsi_snack *) buf; |
2212 | hdr->flags &= ~ISCSI_FLAG_CMD_FINAL; | 2206 | hdr->flags &= ~ISCSI_FLAG_CMD_FINAL; |
2213 | lun = get_unaligned_le64(&hdr->lun); | ||
2214 | unpacked_lun = scsilun_to_int((struct scsi_lun *)&lun); | ||
2215 | hdr->itt = be32_to_cpu(hdr->itt); | 2207 | hdr->itt = be32_to_cpu(hdr->itt); |
2216 | hdr->ttt = be32_to_cpu(hdr->ttt); | 2208 | hdr->ttt = be32_to_cpu(hdr->ttt); |
2217 | hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); | 2209 | hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); |
@@ -3511,7 +3503,6 @@ int iscsi_target_tx_thread(void *arg) | |||
3511 | struct iscsi_cmd *cmd = NULL; | 3503 | struct iscsi_cmd *cmd = NULL; |
3512 | struct iscsi_conn *conn; | 3504 | struct iscsi_conn *conn; |
3513 | struct iscsi_queue_req *qr = NULL; | 3505 | struct iscsi_queue_req *qr = NULL; |
3514 | struct se_cmd *se_cmd; | ||
3515 | struct iscsi_thread_set *ts = arg; | 3506 | struct iscsi_thread_set *ts = arg; |
3516 | /* | 3507 | /* |
3517 | * Allow ourselves to be interrupted by SIGINT so that a | 3508 | * Allow ourselves to be interrupted by SIGINT so that a |
@@ -3694,8 +3685,6 @@ check_rsp_state: | |||
3694 | goto transport_err; | 3685 | goto transport_err; |
3695 | } | 3686 | } |
3696 | 3687 | ||
3697 | se_cmd = &cmd->se_cmd; | ||
3698 | |||
3699 | if (map_sg && !conn->conn_ops->IFMarker) { | 3688 | if (map_sg && !conn->conn_ops->IFMarker) { |
3700 | if (iscsit_fe_sendpage_sg(cmd, conn) < 0) { | 3689 | if (iscsit_fe_sendpage_sg(cmd, conn) < 0) { |
3701 | conn->tx_response_queue = 0; | 3690 | conn->tx_response_queue = 0; |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 18cffff9b456..1046b6259c8f 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -882,7 +882,7 @@ fail: | |||
882 | static int __iscsi_target_login_thread(struct iscsi_np *np) | 882 | static int __iscsi_target_login_thread(struct iscsi_np *np) |
883 | { | 883 | { |
884 | u8 buffer[ISCSI_HDR_LEN], iscsi_opcode, zero_tsih = 0; | 884 | u8 buffer[ISCSI_HDR_LEN], iscsi_opcode, zero_tsih = 0; |
885 | int err, ret = 0, ip_proto, sock_type, set_sctp_conn_flag, stop; | 885 | int err, ret = 0, set_sctp_conn_flag, stop; |
886 | struct iscsi_conn *conn = NULL; | 886 | struct iscsi_conn *conn = NULL; |
887 | struct iscsi_login *login; | 887 | struct iscsi_login *login; |
888 | struct iscsi_portal_group *tpg = NULL; | 888 | struct iscsi_portal_group *tpg = NULL; |
@@ -895,8 +895,6 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
895 | flush_signals(current); | 895 | flush_signals(current); |
896 | set_sctp_conn_flag = 0; | 896 | set_sctp_conn_flag = 0; |
897 | sock = np->np_socket; | 897 | sock = np->np_socket; |
898 | ip_proto = np->np_ip_proto; | ||
899 | sock_type = np->np_sock_type; | ||
900 | 898 | ||
901 | spin_lock_bh(&np->np_thread_lock); | 899 | spin_lock_bh(&np->np_thread_lock); |
902 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { | 900 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 37a20baa1a88..2dba448cac19 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -173,13 +173,11 @@ static int iscsi_target_check_login_request( | |||
173 | struct iscsi_conn *conn, | 173 | struct iscsi_conn *conn, |
174 | struct iscsi_login *login) | 174 | struct iscsi_login *login) |
175 | { | 175 | { |
176 | int req_csg, req_nsg, rsp_csg, rsp_nsg; | 176 | int req_csg, req_nsg; |
177 | u32 payload_length; | 177 | u32 payload_length; |
178 | struct iscsi_login_req *login_req; | 178 | struct iscsi_login_req *login_req; |
179 | struct iscsi_login_rsp *login_rsp; | ||
180 | 179 | ||
181 | login_req = (struct iscsi_login_req *) login->req; | 180 | login_req = (struct iscsi_login_req *) login->req; |
182 | login_rsp = (struct iscsi_login_rsp *) login->rsp; | ||
183 | payload_length = ntoh24(login_req->dlength); | 181 | payload_length = ntoh24(login_req->dlength); |
184 | 182 | ||
185 | switch (login_req->opcode & ISCSI_OPCODE_MASK) { | 183 | switch (login_req->opcode & ISCSI_OPCODE_MASK) { |
@@ -203,9 +201,7 @@ static int iscsi_target_check_login_request( | |||
203 | } | 201 | } |
204 | 202 | ||
205 | req_csg = (login_req->flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2; | 203 | req_csg = (login_req->flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2; |
206 | rsp_csg = (login_rsp->flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2; | ||
207 | req_nsg = (login_req->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK); | 204 | req_nsg = (login_req->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK); |
208 | rsp_nsg = (login_rsp->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK); | ||
209 | 205 | ||
210 | if (req_csg != login->current_stage) { | 206 | if (req_csg != login->current_stage) { |
211 | pr_err("Initiator unexpectedly changed login stage" | 207 | pr_err("Initiator unexpectedly changed login stage" |
@@ -753,12 +749,10 @@ static int iscsi_target_locate_portal( | |||
753 | struct iscsi_session *sess = conn->sess; | 749 | struct iscsi_session *sess = conn->sess; |
754 | struct iscsi_tiqn *tiqn; | 750 | struct iscsi_tiqn *tiqn; |
755 | struct iscsi_login_req *login_req; | 751 | struct iscsi_login_req *login_req; |
756 | struct iscsi_targ_login_rsp *login_rsp; | ||
757 | u32 payload_length; | 752 | u32 payload_length; |
758 | int sessiontype = 0, ret = 0; | 753 | int sessiontype = 0, ret = 0; |
759 | 754 | ||
760 | login_req = (struct iscsi_login_req *) login->req; | 755 | login_req = (struct iscsi_login_req *) login->req; |
761 | login_rsp = (struct iscsi_targ_login_rsp *) login->rsp; | ||
762 | payload_length = ntoh24(login_req->dlength); | 756 | payload_length = ntoh24(login_req->dlength); |
763 | 757 | ||
764 | login->first_request = 1; | 758 | login->first_request = 1; |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 026dffa0ed5a..22f4fe77237b 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -1312,7 +1312,6 @@ static struct configfs_attribute *tcm_loop_wwn_attrs[] = { | |||
1312 | static int tcm_loop_register_configfs(void) | 1312 | static int tcm_loop_register_configfs(void) |
1313 | { | 1313 | { |
1314 | struct target_fabric_configfs *fabric; | 1314 | struct target_fabric_configfs *fabric; |
1315 | struct config_group *tf_cg; | ||
1316 | int ret; | 1315 | int ret; |
1317 | /* | 1316 | /* |
1318 | * Set the TCM Loop HBA counter to zero | 1317 | * Set the TCM Loop HBA counter to zero |
@@ -1379,7 +1378,6 @@ static int tcm_loop_register_configfs(void) | |||
1379 | fabric->tf_ops.set_fabric_sense_len = &tcm_loop_set_fabric_sense_len; | 1378 | fabric->tf_ops.set_fabric_sense_len = &tcm_loop_set_fabric_sense_len; |
1380 | fabric->tf_ops.get_fabric_sense_len = &tcm_loop_get_fabric_sense_len; | 1379 | fabric->tf_ops.get_fabric_sense_len = &tcm_loop_get_fabric_sense_len; |
1381 | 1380 | ||
1382 | tf_cg = &fabric->tf_group; | ||
1383 | /* | 1381 | /* |
1384 | * Setup function pointers for generic logic in target_core_fabric_configfs.c | 1382 | * Setup function pointers for generic logic in target_core_fabric_configfs.c |
1385 | */ | 1383 | */ |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 72bd7f5d6795..cbb66537d230 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -2853,7 +2853,6 @@ static void target_core_drop_subdev( | |||
2853 | struct se_subsystem_dev *se_dev = container_of(to_config_group(item), | 2853 | struct se_subsystem_dev *se_dev = container_of(to_config_group(item), |
2854 | struct se_subsystem_dev, se_dev_group); | 2854 | struct se_subsystem_dev, se_dev_group); |
2855 | struct se_hba *hba; | 2855 | struct se_hba *hba; |
2856 | struct se_subsystem_api *t; | ||
2857 | struct config_item *df_item; | 2856 | struct config_item *df_item; |
2858 | struct config_group *dev_cg, *tg_pt_gp_cg, *dev_stat_grp; | 2857 | struct config_group *dev_cg, *tg_pt_gp_cg, *dev_stat_grp; |
2859 | int i; | 2858 | int i; |
@@ -2861,7 +2860,6 @@ static void target_core_drop_subdev( | |||
2861 | hba = item_to_hba(&se_dev->se_dev_hba->hba_group.cg_item); | 2860 | hba = item_to_hba(&se_dev->se_dev_hba->hba_group.cg_item); |
2862 | 2861 | ||
2863 | mutex_lock(&hba->hba_access_mutex); | 2862 | mutex_lock(&hba->hba_access_mutex); |
2864 | t = hba->transport; | ||
2865 | 2863 | ||
2866 | dev_stat_grp = &se_dev->dev_stat_grps.stat_group; | 2864 | dev_stat_grp = &se_dev->dev_stat_grps.stat_group; |
2867 | for (i = 0; dev_stat_grp->default_groups[i]; i++) { | 2865 | for (i = 0; dev_stat_grp->default_groups[i]; i++) { |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 3be7279865b1..aa6267746383 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -647,7 +647,6 @@ int target_report_luns(struct se_task *se_task) | |||
647 | { | 647 | { |
648 | struct se_cmd *se_cmd = se_task->task_se_cmd; | 648 | struct se_cmd *se_cmd = se_task->task_se_cmd; |
649 | struct se_dev_entry *deve; | 649 | struct se_dev_entry *deve; |
650 | struct se_lun *se_lun; | ||
651 | struct se_session *se_sess = se_cmd->se_sess; | 650 | struct se_session *se_sess = se_cmd->se_sess; |
652 | unsigned char *buf; | 651 | unsigned char *buf; |
653 | u32 lun_count = 0, offset = 8, i; | 652 | u32 lun_count = 0, offset = 8, i; |
@@ -672,7 +671,6 @@ int target_report_luns(struct se_task *se_task) | |||
672 | deve = se_sess->se_node_acl->device_list[i]; | 671 | deve = se_sess->se_node_acl->device_list[i]; |
673 | if (!(deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS)) | 672 | if (!(deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS)) |
674 | continue; | 673 | continue; |
675 | se_lun = deve->se_lun; | ||
676 | /* | 674 | /* |
677 | * We determine the correct LUN LIST LENGTH even once we | 675 | * We determine the correct LUN LIST LENGTH even once we |
678 | * have reached the initial allocation length. | 676 | * have reached the initial allocation length. |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index de3e4f2f60bd..5926b171dba0 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -2416,9 +2416,7 @@ static int core_scsi3_pro_reserve( | |||
2416 | u64 res_key) | 2416 | u64 res_key) |
2417 | { | 2417 | { |
2418 | struct se_session *se_sess = cmd->se_sess; | 2418 | struct se_session *se_sess = cmd->se_sess; |
2419 | struct se_dev_entry *se_deve; | ||
2420 | struct se_lun *se_lun = cmd->se_lun; | 2419 | struct se_lun *se_lun = cmd->se_lun; |
2421 | struct se_portal_group *se_tpg; | ||
2422 | struct t10_pr_registration *pr_reg, *pr_res_holder; | 2420 | struct t10_pr_registration *pr_reg, *pr_res_holder; |
2423 | struct t10_reservation *pr_tmpl = &dev->se_sub_dev->t10_pr; | 2421 | struct t10_reservation *pr_tmpl = &dev->se_sub_dev->t10_pr; |
2424 | char i_buf[PR_REG_ISID_ID_LEN]; | 2422 | char i_buf[PR_REG_ISID_ID_LEN]; |
@@ -2431,8 +2429,6 @@ static int core_scsi3_pro_reserve( | |||
2431 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 2429 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2432 | return -EINVAL; | 2430 | return -EINVAL; |
2433 | } | 2431 | } |
2434 | se_tpg = se_sess->se_tpg; | ||
2435 | se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | ||
2436 | /* | 2432 | /* |
2437 | * Locate the existing *pr_reg via struct se_node_acl pointers | 2433 | * Locate the existing *pr_reg via struct se_node_acl pointers |
2438 | */ | 2434 | */ |
@@ -2990,7 +2986,6 @@ static int core_scsi3_pro_preempt( | |||
2990 | int abort) | 2986 | int abort) |
2991 | { | 2987 | { |
2992 | struct se_device *dev = cmd->se_dev; | 2988 | struct se_device *dev = cmd->se_dev; |
2993 | struct se_dev_entry *se_deve; | ||
2994 | struct se_node_acl *pr_reg_nacl; | 2989 | struct se_node_acl *pr_reg_nacl; |
2995 | struct se_session *se_sess = cmd->se_sess; | 2990 | struct se_session *se_sess = cmd->se_sess; |
2996 | LIST_HEAD(preempt_and_abort_list); | 2991 | LIST_HEAD(preempt_and_abort_list); |
@@ -3005,7 +3000,6 @@ static int core_scsi3_pro_preempt( | |||
3005 | return -EINVAL; | 3000 | return -EINVAL; |
3006 | } | 3001 | } |
3007 | 3002 | ||
3008 | se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | ||
3009 | pr_reg_n = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, | 3003 | pr_reg_n = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, |
3010 | se_sess); | 3004 | se_sess); |
3011 | if (!pr_reg_n) { | 3005 | if (!pr_reg_n) { |
@@ -3341,7 +3335,7 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3341 | { | 3335 | { |
3342 | struct se_session *se_sess = cmd->se_sess; | 3336 | struct se_session *se_sess = cmd->se_sess; |
3343 | struct se_device *dev = cmd->se_dev; | 3337 | struct se_device *dev = cmd->se_dev; |
3344 | struct se_dev_entry *se_deve, *dest_se_deve = NULL; | 3338 | struct se_dev_entry *dest_se_deve = NULL; |
3345 | struct se_lun *se_lun = cmd->se_lun; | 3339 | struct se_lun *se_lun = cmd->se_lun; |
3346 | struct se_node_acl *pr_res_nacl, *pr_reg_nacl, *dest_node_acl = NULL; | 3340 | struct se_node_acl *pr_res_nacl, *pr_reg_nacl, *dest_node_acl = NULL; |
3347 | struct se_port *se_port; | 3341 | struct se_port *se_port; |
@@ -3366,7 +3360,6 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3366 | memset(i_buf, 0, PR_REG_ISID_ID_LEN); | 3360 | memset(i_buf, 0, PR_REG_ISID_ID_LEN); |
3367 | se_tpg = se_sess->se_tpg; | 3361 | se_tpg = se_sess->se_tpg; |
3368 | tf_ops = se_tpg->se_tpg_tfo; | 3362 | tf_ops = se_tpg->se_tpg_tfo; |
3369 | se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | ||
3370 | /* | 3363 | /* |
3371 | * Follow logic from spc4r17 Section 5.7.8, Table 50 -- | 3364 | * Follow logic from spc4r17 Section 5.7.8, Table 50 -- |
3372 | * Register behaviors for a REGISTER AND MOVE service action | 3365 | * Register behaviors for a REGISTER AND MOVE service action |
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c index 7ce1bfa5c542..3d44beb0cf1f 100644 --- a/drivers/target/target_core_stat.c +++ b/drivers/target/target_core_stat.c | |||
@@ -954,7 +954,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_in_cmds( | |||
954 | { | 954 | { |
955 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 955 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); |
956 | struct se_port *sep; | 956 | struct se_port *sep; |
957 | struct se_portal_group *tpg; | ||
958 | ssize_t ret; | 957 | ssize_t ret; |
959 | 958 | ||
960 | spin_lock(&lun->lun_sep_lock); | 959 | spin_lock(&lun->lun_sep_lock); |
@@ -963,7 +962,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_in_cmds( | |||
963 | spin_unlock(&lun->lun_sep_lock); | 962 | spin_unlock(&lun->lun_sep_lock); |
964 | return -ENODEV; | 963 | return -ENODEV; |
965 | } | 964 | } |
966 | tpg = sep->sep_tpg; | ||
967 | 965 | ||
968 | ret = snprintf(page, PAGE_SIZE, "%llu\n", sep->sep_stats.cmd_pdus); | 966 | ret = snprintf(page, PAGE_SIZE, "%llu\n", sep->sep_stats.cmd_pdus); |
969 | spin_unlock(&lun->lun_sep_lock); | 967 | spin_unlock(&lun->lun_sep_lock); |
@@ -976,7 +974,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( | |||
976 | { | 974 | { |
977 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 975 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); |
978 | struct se_port *sep; | 976 | struct se_port *sep; |
979 | struct se_portal_group *tpg; | ||
980 | ssize_t ret; | 977 | ssize_t ret; |
981 | 978 | ||
982 | spin_lock(&lun->lun_sep_lock); | 979 | spin_lock(&lun->lun_sep_lock); |
@@ -985,7 +982,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( | |||
985 | spin_unlock(&lun->lun_sep_lock); | 982 | spin_unlock(&lun->lun_sep_lock); |
986 | return -ENODEV; | 983 | return -ENODEV; |
987 | } | 984 | } |
988 | tpg = sep->sep_tpg; | ||
989 | 985 | ||
990 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 986 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
991 | (u32)(sep->sep_stats.rx_data_octets >> 20)); | 987 | (u32)(sep->sep_stats.rx_data_octets >> 20)); |
@@ -999,7 +995,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( | |||
999 | { | 995 | { |
1000 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 996 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); |
1001 | struct se_port *sep; | 997 | struct se_port *sep; |
1002 | struct se_portal_group *tpg; | ||
1003 | ssize_t ret; | 998 | ssize_t ret; |
1004 | 999 | ||
1005 | spin_lock(&lun->lun_sep_lock); | 1000 | spin_lock(&lun->lun_sep_lock); |
@@ -1008,7 +1003,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( | |||
1008 | spin_unlock(&lun->lun_sep_lock); | 1003 | spin_unlock(&lun->lun_sep_lock); |
1009 | return -ENODEV; | 1004 | return -ENODEV; |
1010 | } | 1005 | } |
1011 | tpg = sep->sep_tpg; | ||
1012 | 1006 | ||
1013 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 1007 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
1014 | (u32)(sep->sep_stats.tx_data_octets >> 20)); | 1008 | (u32)(sep->sep_stats.tx_data_octets >> 20)); |
@@ -1022,7 +1016,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_hs_in_cmds( | |||
1022 | { | 1016 | { |
1023 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 1017 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); |
1024 | struct se_port *sep; | 1018 | struct se_port *sep; |
1025 | struct se_portal_group *tpg; | ||
1026 | ssize_t ret; | 1019 | ssize_t ret; |
1027 | 1020 | ||
1028 | spin_lock(&lun->lun_sep_lock); | 1021 | spin_lock(&lun->lun_sep_lock); |
@@ -1031,7 +1024,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_hs_in_cmds( | |||
1031 | spin_unlock(&lun->lun_sep_lock); | 1024 | spin_unlock(&lun->lun_sep_lock); |
1032 | return -ENODEV; | 1025 | return -ENODEV; |
1033 | } | 1026 | } |
1034 | tpg = sep->sep_tpg; | ||
1035 | 1027 | ||
1036 | /* FIXME: scsiTgtPortHsInCommands */ | 1028 | /* FIXME: scsiTgtPortHsInCommands */ |
1037 | ret = snprintf(page, PAGE_SIZE, "%u\n", 0); | 1029 | ret = snprintf(page, PAGE_SIZE, "%u\n", 0); |
@@ -1275,7 +1267,6 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev( | |||
1275 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1267 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1276 | struct se_dev_entry *deve; | 1268 | struct se_dev_entry *deve; |
1277 | struct se_lun *lun; | 1269 | struct se_lun *lun; |
1278 | struct se_portal_group *tpg; | ||
1279 | ssize_t ret; | 1270 | ssize_t ret; |
1280 | 1271 | ||
1281 | spin_lock_irq(&nacl->device_list_lock); | 1272 | spin_lock_irq(&nacl->device_list_lock); |
@@ -1284,7 +1275,6 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev( | |||
1284 | spin_unlock_irq(&nacl->device_list_lock); | 1275 | spin_unlock_irq(&nacl->device_list_lock); |
1285 | return -ENODEV; | 1276 | return -ENODEV; |
1286 | } | 1277 | } |
1287 | tpg = nacl->se_tpg; | ||
1288 | lun = deve->se_lun; | 1278 | lun = deve->se_lun; |
1289 | /* scsiDeviceIndex */ | 1279 | /* scsiDeviceIndex */ |
1290 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_se_dev->dev_index); | 1280 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_se_dev->dev_index); |
@@ -1643,7 +1633,6 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( | |||
1643 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1633 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1644 | struct se_dev_entry *deve; | 1634 | struct se_dev_entry *deve; |
1645 | struct se_lun *lun; | 1635 | struct se_lun *lun; |
1646 | struct se_portal_group *tpg; | ||
1647 | ssize_t ret; | 1636 | ssize_t ret; |
1648 | 1637 | ||
1649 | spin_lock_irq(&nacl->device_list_lock); | 1638 | spin_lock_irq(&nacl->device_list_lock); |
@@ -1652,7 +1641,6 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( | |||
1652 | spin_unlock_irq(&nacl->device_list_lock); | 1641 | spin_unlock_irq(&nacl->device_list_lock); |
1653 | return -ENODEV; | 1642 | return -ENODEV; |
1654 | } | 1643 | } |
1655 | tpg = nacl->se_tpg; | ||
1656 | lun = deve->se_lun; | 1644 | lun = deve->se_lun; |
1657 | /* scsiDeviceIndex */ | 1645 | /* scsiDeviceIndex */ |
1658 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_se_dev->dev_index); | 1646 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_se_dev->dev_index); |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index c0fecde02fd0..70c3ffb981e7 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -359,7 +359,7 @@ void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *nacl) | |||
359 | 359 | ||
360 | void core_tpg_clear_object_luns(struct se_portal_group *tpg) | 360 | void core_tpg_clear_object_luns(struct se_portal_group *tpg) |
361 | { | 361 | { |
362 | int i, ret; | 362 | int i; |
363 | struct se_lun *lun; | 363 | struct se_lun *lun; |
364 | 364 | ||
365 | spin_lock(&tpg->tpg_lun_lock); | 365 | spin_lock(&tpg->tpg_lun_lock); |
@@ -371,7 +371,7 @@ void core_tpg_clear_object_luns(struct se_portal_group *tpg) | |||
371 | continue; | 371 | continue; |
372 | 372 | ||
373 | spin_unlock(&tpg->tpg_lun_lock); | 373 | spin_unlock(&tpg->tpg_lun_lock); |
374 | ret = core_dev_del_lun(tpg, lun->unpacked_lun); | 374 | core_dev_del_lun(tpg, lun->unpacked_lun); |
375 | spin_lock(&tpg->tpg_lun_lock); | 375 | spin_lock(&tpg->tpg_lun_lock); |
376 | } | 376 | } |
377 | spin_unlock(&tpg->tpg_lun_lock); | 377 | spin_unlock(&tpg->tpg_lun_lock); |
@@ -483,12 +483,11 @@ int core_tpg_del_initiator_node_acl( | |||
483 | LIST_HEAD(sess_list); | 483 | LIST_HEAD(sess_list); |
484 | struct se_session *sess, *sess_tmp; | 484 | struct se_session *sess, *sess_tmp; |
485 | unsigned long flags; | 485 | unsigned long flags; |
486 | int dynamic_acl = 0, rc; | 486 | int rc; |
487 | 487 | ||
488 | spin_lock_irq(&tpg->acl_node_lock); | 488 | spin_lock_irq(&tpg->acl_node_lock); |
489 | if (acl->dynamic_node_acl) { | 489 | if (acl->dynamic_node_acl) { |
490 | acl->dynamic_node_acl = 0; | 490 | acl->dynamic_node_acl = 0; |
491 | dynamic_acl = 1; | ||
492 | } | 491 | } |
493 | list_del(&acl->acl_list); | 492 | list_del(&acl->acl_list); |
494 | tpg->num_node_acls--; | 493 | tpg->num_node_acls--; |
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index a1d1f3c86447..b30f92bdc1a4 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c | |||
@@ -319,11 +319,9 @@ int ft_sess_shutdown(struct se_session *se_sess) | |||
319 | void ft_sess_close(struct se_session *se_sess) | 319 | void ft_sess_close(struct se_session *se_sess) |
320 | { | 320 | { |
321 | struct ft_sess *sess = se_sess->fabric_sess_ptr; | 321 | struct ft_sess *sess = se_sess->fabric_sess_ptr; |
322 | struct fc_lport *lport; | ||
323 | u32 port_id; | 322 | u32 port_id; |
324 | 323 | ||
325 | mutex_lock(&ft_lport_lock); | 324 | mutex_lock(&ft_lport_lock); |
326 | lport = sess->tport->lport; | ||
327 | port_id = sess->port_id; | 325 | port_id = sess->port_id; |
328 | if (port_id == -1) { | 326 | if (port_id == -1) { |
329 | mutex_unlock(&ft_lport_lock); | 327 | mutex_unlock(&ft_lport_lock); |