diff options
author | Jörn Engel <joern@logfs.org> | 2012-03-15 23:06:58 +0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-03-16 06:16:09 +0400 |
commit | 281689051a628e5341ce1efcfafde9d60f2f6fbb (patch) | |
tree | 15809410fe5d1c8540622f5bd7c726517b22ddd3 /drivers/target | |
parent | f2083241f23722207676025abbb45a301d412e69 (diff) | |
download | linux-281689051a628e5341ce1efcfafde9d60f2f6fbb.tar.xz |
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( unsigned char *ping_data = NULL; int cmdsn_ret, niov = 0, ret = 0, rx_got, rx_size; u32 checksum, data_crc, padding = 0, payload_length; - u64 lun; struct iscsi_cmd *cmd = NULL; struct kvec *iov = NULL; struct iscsi_nopout *hdr; hdr = (struct iscsi_nopout *) buf; payload_length = ntoh24(hdr->dlength); - lun = get_unaligned_le64(&hdr->lun); hdr->itt = be32_to_cpu(hdr->itt); hdr->ttt = be32_to_cpu(hdr->ttt); hdr->cmdsn = be32_to_cpu(hdr->cmdsn); @@ -1686,13 +1684,11 @@ static int iscsit_handle_task_mgt_cmd( struct se_tmr_req *se_tmr; struct iscsi_tmr_req *tmr_req; struct iscsi_tm *hdr; - u32 payload_length; int out_of_order_cmdsn = 0; int ret; u8 function; hdr = (struct iscsi_tm *) buf; - payload_length = ntoh24(hdr->dlength); hdr->itt = be32_to_cpu(hdr->itt); hdr->rtt = be32_to_cpu(hdr->rtt); hdr->cmdsn = be32_to_cpu(hdr->cmdsn); @@ -2204,14 +2200,10 @@ static int iscsit_handle_snack( struct iscsi_conn *conn, unsigned char *buf) { - u32 unpacked_lun; - u64 lun; struct iscsi_snack *hdr; hdr = (struct iscsi_snack *) buf; hdr->flags &= ~ISCSI_FLAG_CMD_FINAL; - lun = get_unaligned_le64(&hdr->lun); - unpacked_lun = scsilun_to_int((struct scsi_lun *)&lun); hdr->itt = be32_to_cpu(hdr->itt); hdr->ttt = be32_to_cpu(hdr->ttt); hdr->exp_statsn = be32_to_cpu(hdr->exp_statsn); @@ -3511,7 +3503,6 @@ int iscsi_target_tx_thread(void *arg) struct iscsi_cmd *cmd = NULL; struct iscsi_conn *conn; struct iscsi_queue_req *qr = NULL; - struct se_cmd *se_cmd; struct iscsi_thread_set *ts = arg; /* * Allow ourselves to be interrupted by SIGINT so that a @@ -3694,8 +3685,6 @@ check_rsp_state: goto transport_err; } - se_cmd = &cmd->se_cmd; - if (map_sg && !conn->conn_ops->IFMarker) { if (iscsit_fe_sendpage_sg(cmd, conn) < 0) { 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: static int __iscsi_target_login_thread(struct iscsi_np *np) { u8 buffer[ISCSI_HDR_LEN], iscsi_opcode, zero_tsih = 0; - int err, ret = 0, ip_proto, sock_type, set_sctp_conn_flag, stop; + int err, ret = 0, set_sctp_conn_flag, stop; struct iscsi_conn *conn = NULL; struct iscsi_login *login; struct iscsi_portal_group *tpg = NULL; @@ -895,8 +895,6 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) flush_signals(current); set_sctp_conn_flag = 0; sock = np->np_socket; - ip_proto = np->np_ip_proto; - sock_type = np->np_sock_type; spin_lock_bh(&np->np_thread_lock); 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( struct iscsi_conn *conn, struct iscsi_login *login) { - int req_csg, req_nsg, rsp_csg, rsp_nsg; + int req_csg, req_nsg; u32 payload_length; struct iscsi_login_req *login_req; - struct iscsi_login_rsp *login_rsp; login_req = (struct iscsi_login_req *) login->req; - login_rsp = (struct iscsi_login_rsp *) login->rsp; payload_length = ntoh24(login_req->dlength); switch (login_req->opcode & ISCSI_OPCODE_MASK) { @@ -203,9 +201,7 @@ static int iscsi_target_check_login_request( } req_csg = (login_req->flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2; - rsp_csg = (login_rsp->flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2; req_nsg = (login_req->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK); - rsp_nsg = (login_rsp->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK); if (req_csg != login->current_stage) { pr_err("Initiator unexpectedly changed login stage" @@ -753,12 +749,10 @@ static int iscsi_target_locate_portal( struct iscsi_session *sess = conn->sess; struct iscsi_tiqn *tiqn; struct iscsi_login_req *login_req; - struct iscsi_targ_login_rsp *login_rsp; u32 payload_length; int sessiontype = 0, ret = 0; login_req = (struct iscsi_login_req *) login->req; - login_rsp = (struct iscsi_targ_login_rsp *) login->rsp; payload_length = ntoh24(login_req->dlength); 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[] = { static int tcm_loop_register_configfs(void) { struct target_fabric_configfs *fabric; - struct config_group *tf_cg; int ret; /* * Set the TCM Loop HBA counter to zero @@ -1379,7 +1378,6 @@ static int tcm_loop_register_configfs(void) fabric->tf_ops.set_fabric_sense_len = &tcm_loop_set_fabric_sense_len; fabric->tf_ops.get_fabric_sense_len = &tcm_loop_get_fabric_sense_len; - tf_cg = &fabric->tf_group; /* * Setup function pointers for generic logic in target_core_fabric_configfs.c */ 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( struct se_subsystem_dev *se_dev = container_of(to_config_group(item), struct se_subsystem_dev, se_dev_group); struct se_hba *hba; - struct se_subsystem_api *t; struct config_item *df_item; struct config_group *dev_cg, *tg_pt_gp_cg, *dev_stat_grp; int i; @@ -2861,7 +2860,6 @@ static void target_core_drop_subdev( hba = item_to_hba(&se_dev->se_dev_hba->hba_group.cg_item); mutex_lock(&hba->hba_access_mutex); - t = hba->transport; dev_stat_grp = &se_dev->dev_stat_grps.stat_group; 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) { struct se_cmd *se_cmd = se_task->task_se_cmd; struct se_dev_entry *deve; - struct se_lun *se_lun; struct se_session *se_sess = se_cmd->se_sess; unsigned char *buf; u32 lun_count = 0, offset = 8, i; @@ -672,7 +671,6 @@ int target_report_luns(struct se_task *se_task) deve = se_sess->se_node_acl->device_list[i]; if (!(deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS)) continue; - se_lun = deve->se_lun; /* * We determine the correct LUN LIST LENGTH even once we * 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( u64 res_key) { struct se_session *se_sess = cmd->se_sess; - struct se_dev_entry *se_deve; struct se_lun *se_lun = cmd->se_lun; - struct se_portal_group *se_tpg; struct t10_pr_registration *pr_reg, *pr_res_holder; struct t10_reservation *pr_tmpl = &dev->se_sub_dev->t10_pr; char i_buf[PR_REG_ISID_ID_LEN]; @@ -2431,8 +2429,6 @@ static int core_scsi3_pro_reserve( cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; return -EINVAL; } - se_tpg = se_sess->se_tpg; - se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; /* * Locate the existing *pr_reg via struct se_node_acl pointers */ @@ -2990,7 +2986,6 @@ static int core_scsi3_pro_preempt( int abort) { struct se_device *dev = cmd->se_dev; - struct se_dev_entry *se_deve; struct se_node_acl *pr_reg_nacl; struct se_session *se_sess = cmd->se_sess; LIST_HEAD(preempt_and_abort_list); @@ -3005,7 +3000,6 @@ static int core_scsi3_pro_preempt( return -EINVAL; } - se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; pr_reg_n = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, se_sess); if (!pr_reg_n) { @@ -3341,7 +3335,7 @@ static int core_scsi3_emulate_pro_register_and_move( { struct se_session *se_sess = cmd->se_sess; struct se_device *dev = cmd->se_dev; - struct se_dev_entry *se_deve, *dest_se_deve = NULL; + struct se_dev_entry *dest_se_deve = NULL; struct se_lun *se_lun = cmd->se_lun; struct se_node_acl *pr_res_nacl, *pr_reg_nacl, *dest_node_acl = NULL; struct se_port *se_port; @@ -3366,7 +3360,6 @@ static int core_scsi3_emulate_pro_register_and_move( memset(i_buf, 0, PR_REG_ISID_ID_LEN); se_tpg = se_sess->se_tpg; tf_ops = se_tpg->se_tpg_tfo; - se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; /* * Follow logic from spc4r17 Section 5.7.8, Table 50 -- * 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( { struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); struct se_port *sep; - struct se_portal_group *tpg; ssize_t ret; spin_lock(&lun->lun_sep_lock); @@ -963,7 +962,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_in_cmds( spin_unlock(&lun->lun_sep_lock); return -ENODEV; } - tpg = sep->sep_tpg; ret = snprintf(page, PAGE_SIZE, "%llu\n", sep->sep_stats.cmd_pdus); spin_unlock(&lun->lun_sep_lock); @@ -976,7 +974,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( { struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); struct se_port *sep; - struct se_portal_group *tpg; ssize_t ret; spin_lock(&lun->lun_sep_lock); @@ -985,7 +982,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( spin_unlock(&lun->lun_sep_lock); return -ENODEV; } - tpg = sep->sep_tpg; ret = snprintf(page, PAGE_SIZE, "%u\n", (u32)(sep->sep_stats.rx_data_octets >> 20)); @@ -999,7 +995,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( { struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); struct se_port *sep; - struct se_portal_group *tpg; ssize_t ret; spin_lock(&lun->lun_sep_lock); @@ -1008,7 +1003,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( spin_unlock(&lun->lun_sep_lock); return -ENODEV; } - tpg = sep->sep_tpg; ret = snprintf(page, PAGE_SIZE, "%u\n", (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( { struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); struct se_port *sep; - struct se_portal_group *tpg; ssize_t ret; spin_lock(&lun->lun_sep_lock); @@ -1031,7 +1024,6 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_hs_in_cmds( spin_unlock(&lun->lun_sep_lock); return -ENODEV; } - tpg = sep->sep_tpg; /* FIXME: scsiTgtPortHsInCommands */ ret = snprintf(page, PAGE_SIZE, "%u\n", 0); @@ -1275,7 +1267,6 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev( struct se_node_acl *nacl = lacl->se_lun_nacl; struct se_dev_entry *deve; struct se_lun *lun; - struct se_portal_group *tpg; ssize_t ret; spin_lock_irq(&nacl->device_list_lock); @@ -1284,7 +1275,6 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev( spin_unlock_irq(&nacl->device_list_lock); return -ENODEV; } - tpg = nacl->se_tpg; lun = deve->se_lun; /* scsiDeviceIndex */ 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( struct se_node_acl *nacl = lacl->se_lun_nacl; struct se_dev_entry *deve; struct se_lun *lun; - struct se_portal_group *tpg; ssize_t ret; spin_lock_irq(&nacl->device_list_lock); @@ -1652,7 +1641,6 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( spin_unlock_irq(&nacl->device_list_lock); return -ENODEV; } - tpg = nacl->se_tpg; lun = deve->se_lun; /* scsiDeviceIndex */ 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) void core_tpg_clear_object_luns(struct se_portal_group *tpg) { - int i, ret; + int i; struct se_lun *lun; spin_lock(&tpg->tpg_lun_lock); @@ -371,7 +371,7 @@ void core_tpg_clear_object_luns(struct se_portal_group *tpg) continue; spin_unlock(&tpg->tpg_lun_lock); - ret = core_dev_del_lun(tpg, lun->unpacked_lun); + core_dev_del_lun(tpg, lun->unpacked_lun); spin_lock(&tpg->tpg_lun_lock); } spin_unlock(&tpg->tpg_lun_lock); @@ -483,12 +483,11 @@ int core_tpg_del_initiator_node_acl( LIST_HEAD(sess_list); struct se_session *sess, *sess_tmp; unsigned long flags; - int dynamic_acl = 0, rc; + int rc; spin_lock_irq(&tpg->acl_node_lock); if (acl->dynamic_node_acl) { acl->dynamic_node_acl = 0; - dynamic_acl = 1; } list_del(&acl->acl_list); 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) void ft_sess_close(struct se_session *se_sess) { struct ft_sess *sess = se_sess->fabric_sess_ptr; - struct fc_lport *lport; u32 port_id; mutex_lock(&ft_lport_lock); - lport = sess->tport->lport; port_id = sess->port_id; if (port_id == -1) { mutex_unlock(&ft_lport_lock); |