diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index dd80debbe..20990cfca 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -102,7 +102,7 @@ static int iscsi_session_alloc(struct iscsi_target *target, if (!session->sess_params.rdma_extensions) { err = iscsi_threads_pool_get( - (bool)scst_get_acg_tgt_priv(session->scst_sess->acg), + scst_get_acg_tgt_priv(session->scst_sess->acg) != NULL, &session->scst_sess->acg->acg_cpu_mask, &session->sess_thr_pool); if (err != 0) diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index 3abe23f21..3b563139f 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -665,7 +665,7 @@ static ssize_t iscsi_acg_sess_dedicated_threads_show(struct kobject *kobj, TRACE_ENTRY(); acg = container_of(kobj, struct scst_acg, acg_kobj); - dedicated = (bool)scst_get_acg_tgt_priv(acg); + dedicated = scst_get_acg_tgt_priv(acg) != NULL; pos = sprintf(buf, "%d\n%s", dedicated, dedicated ? SCST_SYSFS_KEY_MARK "\n" : ""); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index c35137b55..5c4897e18 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -4805,7 +4805,8 @@ static void scst_free_acg(struct scst_acg *acg) struct scst_session *sess; struct scst_tgt *tgt = acg->tgt; - TRACE_DBG("Freeing acg %s/%s", tgt->tgt_name, acg->acg_name); + /* For procfs acg->tgt could be NULL */ + TRACE_DBG("Freeing acg %s/%s", tgt ? tgt->tgt_name : "(tgt=NULL)", acg->acg_name); list_for_each_entry_safe(acg_dev, acg_dev_tmp, &acg->acg_dev_list, acg_dev_list_entry) { @@ -6231,8 +6232,6 @@ static void scst_ws_write_cmd_finished(struct scst_cmd *cmd) wsp->ws_cur_in_flight--; if (cmd->status != 0) { - int rc; - TRACE_DBG("Write cmd %p (ws cmd %p) finished not successfully", cmd, ws_cmd); sBUG_ON(cmd->resp_data_len != 0); @@ -6662,8 +6661,6 @@ static void scst_cwr_read_cmd_finished(struct scst_cmd *cmd) TRACE_DBG("READ cmd %p finished (cwr cmd %p)", cmd, cwr_cmd); if (cmd->status != 0) { - int rc; - TRACE_DBG("Read cmd %p (cwr cmd %p) finished not successfully", cmd, cwr_cmd); sBUG_ON(cmd->resp_data_len != 0); diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index ce6c5126f..02f4d68ff 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -2569,7 +2569,7 @@ out_unlock: /* Called with dev_pr_mutex locked, no IRQ */ void scst_pr_read_keys(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) { - int i, offset = 0, size, size_max; + int offset = 0, size, size_max; struct scst_device *dev = cmd->dev; struct scst_dev_registrant *reg; @@ -2592,7 +2592,6 @@ void scst_pr_read_keys(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) size = 0; size_max = buffer_size - 8; - i = 0; list_for_each_entry(reg, &dev->dev_registrants_list, dev_registrants_list_entry) { if (size_max - size >= 8) { @@ -2602,7 +2601,7 @@ void scst_pr_read_keys(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) WARN_ON(reg->key == 0); put_unaligned(reg->key, - (__be64 *)&buffer[offset + 8 * i]); + (__be64 *)&buffer[offset]); offset += 8; } diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index dd392d811..cae7ca5be 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -4131,7 +4131,7 @@ next: if (likely(scst_cmd_completed_good(cmd))) { if (cmd->deferred_dif_read_check) { - int rc = scst_dif_process_read(cmd); + rc = scst_dif_process_read(cmd); if (unlikely(rc != 0)) { cmd->deferred_dif_read_check = 0; @@ -7452,7 +7452,6 @@ static int scst_mgmt_affected_cmds_done(struct scst_mgmt_cmd *mcmd) list_for_each_entry(s, &tgt->sess_list, sess_list_entry) { for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) { struct list_head *head = &s->sess_tgt_dev_list[i]; - struct scst_tgt_dev *tgt_dev; list_for_each_entry_rcu(tgt_dev, head, sess_tgt_dev_list_entry) { diff --git a/usr/fileio/common.c b/usr/fileio/common.c index 2591cd7b3..ed112222c 100644 --- a/usr/fileio/common.c +++ b/usr/fileio/common.c @@ -120,7 +120,7 @@ static int set_sense(uint8_t *buffer, int len, int key, int asc, int ascq) * scst_set_invalid_field_in_parm_list() */ -void set_cmd_error(struct vdisk_cmd *vcmd, int key, int asc, int ascq) +static void set_cmd_error(struct vdisk_cmd *vcmd, int key, int asc, int ascq) { struct scst_user_scsi_cmd_reply_exec *reply = &vcmd->reply->exec_reply; @@ -137,7 +137,7 @@ void set_cmd_error(struct vdisk_cmd *vcmd, int key, int asc, int ascq) return; } -void set_busy(struct vdisk_cmd *vcmd) +static void set_busy(struct vdisk_cmd *vcmd) { TRACE_ENTRY(); @@ -189,7 +189,7 @@ out: return res; } -struct vdisk_tgt_dev *find_tgt_dev(struct vdisk_dev *dev, uint64_t sess_h) +static struct vdisk_tgt_dev *find_tgt_dev(struct vdisk_dev *dev, uint64_t sess_h) { unsigned int i; struct vdisk_tgt_dev *res = NULL; @@ -203,7 +203,7 @@ struct vdisk_tgt_dev *find_tgt_dev(struct vdisk_dev *dev, uint64_t sess_h) return res; } -struct vdisk_tgt_dev *find_empty_tgt_dev(struct vdisk_dev *dev) +static struct vdisk_tgt_dev *find_empty_tgt_dev(struct vdisk_dev *dev) { unsigned int i; struct vdisk_tgt_dev *res = NULL; diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index 2c51ab6f9..bd97594fa 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -203,7 +203,7 @@ static void *align_alloc(size_t size) return memalign(PAGE_SIZE, size); } -void sigalrm_handler(int signo) +static void sigalrm_handler(int signo) { int res, i; @@ -234,7 +234,7 @@ out: return; } -void sigusr1_handler(int signo) +static void sigusr1_handler(int signo) { int res, i; @@ -258,7 +258,7 @@ out: return; } -int prealloc_buffers(struct vdisk_dev *dev) +static int prealloc_buffers(struct vdisk_dev *dev) { int i, c, res = 0; @@ -300,7 +300,7 @@ out: return res; } -int start(int argc, char **argv) +static int start(int argc, char **argv) { int res = 0; int fd; diff --git a/usr/stpgd/stpgd_main.c b/usr/stpgd/stpgd_main.c index be0796248..a99b87b20 100644 --- a/usr/stpgd/stpgd_main.c +++ b/usr/stpgd/stpgd_main.c @@ -94,7 +94,7 @@ static void stpg_handle_tm_received(struct scst_event_user *event_user) */ } -int invoke_stpg(const uint8_t *device_name, +static int invoke_stpg(const uint8_t *device_name, const struct scst_event_stpg_descr *descr, pid_t *out_pid) { char *args[7], *env[7]; @@ -175,7 +175,7 @@ out: } /* Returns 0, if the pid is still running, >0 if it was exited or <0 error code */ -int wait_until_finished(pid_t pid, unsigned long deadline, int *status, int child) +static int wait_until_finished(pid_t pid, unsigned long deadline, int *status, int child) { int res; time_t start, end; @@ -204,7 +204,7 @@ int wait_until_finished(pid_t pid, unsigned long deadline, int *status, int chil return res; } -int handle_stpg_received(struct scst_event_user *event_user) +static int handle_stpg_received(struct scst_event_user *event_user) { const struct scst_event_stpg_payload *p = (struct scst_event_stpg_payload *)event_user->out_event.payload; int num, k; @@ -426,7 +426,7 @@ out: return res; } -void sig_chld(int signal) +static void sig_chld(int signal) { /* Check just in case */ if (signal == SIGCHLD) {