From bc1cda46dff7a7fbba236243f50e8bb6760c226c Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 24 May 2010 12:32:45 +0000 Subject: [PATCH] Sparse cleanups git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1713 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 6 +++--- iscsi-scst/kernel/nthread.c | 2 +- iscsi-scst/kernel/session.c | 6 +++--- iscsi-scst/kernel/target.c | 2 +- scst/src/dev_handlers/scst_vdisk.c | 2 +- scst/src/scst_main.c | 2 -- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index dac5d69de..738290ca3 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -975,9 +975,9 @@ static int create_reject_rsp(struct iscsi_cmnd *req, int reason, bool get_data) if (cmnd_opcode(req) == ISCSI_OP_SCSI_CMD) { if (req->scst_cmd == NULL) { /* BUSY status must be already set */ - struct iscsi_scsi_rsp_hdr *rsp_hdr; - rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&req->main_rsp->pdu.bhs; - sBUG_ON(rsp_hdr->cmd_status == 0); + struct iscsi_scsi_rsp_hdr *rsp_hdr1; + rsp_hdr1 = (struct iscsi_scsi_rsp_hdr *)&req->main_rsp->pdu.bhs; + sBUG_ON(rsp_hdr1->cmd_status == 0); /* * Let's not send REJECT here. The initiator will retry * and, hopefully, next time we will not fail allocating diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index a9a7b4755..c4ed26887 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1140,7 +1140,6 @@ static inline void __iscsi_put_page_callback(struct iscsi_cmnd *cmd) {} void req_add_to_write_timeout_list(struct iscsi_cmnd *req) { struct iscsi_conn *conn; - unsigned long timeout_time; bool set_conn_tm_active = false; TRACE_ENTRY(); @@ -1168,6 +1167,7 @@ void req_add_to_write_timeout_list(struct iscsi_cmnd *req) &conn->write_timeout_list); if (!timer_pending(&conn->rsp_timer)) { + unsigned long timeout_time; if (unlikely(conn->conn_tm_active || test_bit(ISCSI_CMD_ABORTED, &req->prelim_compl_flags))) { diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index 436df90f8..9ebda5ddc 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -175,9 +175,9 @@ int __add_session(struct iscsi_target *target, */ list_for_each_entry_reverse(sess, &target->session_list, session_list_entry) { - union iscsi_sid i = *(union iscsi_sid *)&sess->sid; - i.id.tsih = 0; - if ((sid.id64 == i.id64) && + union iscsi_sid s = *(union iscsi_sid *)&sess->sid; + s.id.tsih = 0; + if ((sid.id64 == s.id64) && (strcmp(info->initiator_name, sess->initiator_name) == 0)) { if (!sess->sess_shutting_down) { /* session reinstatement */ diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index 4983ab818..b8352ef2d 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -119,7 +119,7 @@ int __add_target(struct iscsi_kern_target_info *info) { int err; u32 tid = info->tid; - struct iscsi_target *target; + struct iscsi_target *target = NULL; /* to calm down sparse */ struct iscsi_kern_params_info *params_info; struct iscsi_kern_attr *attr_info; union add_info_union { diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index ffc5f6922..247e808b8 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2493,7 +2493,7 @@ restart: * Probably that's wrong, but sometimes write() returns * value less, than requested. Let's restart. */ - int i, e = eiv_count; + int e = eiv_count; TRACE_MGMT_DBG("write() returned %d from %zd " "(iv_count=%d)", (int)err, full_len, eiv_count); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index dff43eeba..ad23d50b9 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -1445,8 +1445,6 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads, } for (i = 0; i < num; i++) { - struct scst_cmd_thread_t *thr; - thr = kmalloc(sizeof(*thr), GFP_KERNEL); if (!thr) { res = -ENOMEM;