From a2e0916fbf625adc51c84862562a4f1c071e7319 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 13 Apr 2017 23:58:32 +0000 Subject: [PATCH] Fix a few compiler messages issued when some extra warnings are enabled: casting const to non-const uninitialized structure members non-static local function missing enumerated switch-value cases Signed-off-by: David Butterfield git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7122 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/nthread.c | 4 +++- iscsi-scst/usr/config.c | 6 +++--- iscsi-scst/usr/iscsid.c | 18 +++++++++--------- iscsi-scst/usr/misc.c | 2 +- scst/src/dev_handlers/scst_vdisk.c | 3 +++ scst/src/scst_lib.c | 4 ++++ scst/src/scst_proc.c | 1 + scst/src/scst_targ.c | 2 ++ scst/src/scst_tg.c | 3 +++ 9 files changed, 29 insertions(+), 14 deletions(-) diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 4c60d4b3c..1da2f808d 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1687,8 +1687,10 @@ static int tx_padding(struct iscsi_cmnd *cmnd, int state) int res, rest = cmnd->conn->write_size; struct msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT}; struct kvec iov; - static const uint32_t padding; + static uint32_t padding; + BUG_ON(rest < 1); + BUG_ON(rest >= sizeof(uint32_t)); iscsi_extracheck_is_wr_thread(cmnd->conn); TRACE_DBG("Sending %d padding bytes (cmd %p)", rest, cmnd); diff --git a/iscsi-scst/usr/config.c b/iscsi-scst/usr/config.c index 8ac6fa731..ba2ed557e 100644 --- a/iscsi-scst/usr/config.c +++ b/iscsi-scst/usr/config.c @@ -41,9 +41,9 @@ * be the last to confirm expectations of __config_account_add()!! */ struct iscsi_key user_keys[] = { - {"IncomingUser",}, - {"OutgoingUser",}, - {NULL,}, + { .name = "IncomingUser",}, + { .name = "OutgoingUser",}, + { .name = NULL,}, }; static struct __qelem discovery_users_in = LIST_HEAD_INIT(discovery_users_in); diff --git a/iscsi-scst/usr/iscsid.c b/iscsi-scst/usr/iscsid.c index c0a58fa97..62f6a10bb 100644 --- a/iscsi-scst/usr/iscsid.c +++ b/iscsi-scst/usr/iscsid.c @@ -37,15 +37,15 @@ static u32 get_next_ttt(struct connection *conn __attribute__((unused))) } static struct iscsi_key login_keys[] = { - {"InitiatorName",}, - {"InitiatorAlias",}, - {"SessionType",}, - {"TargetName",}, - {"InitiatorRecvDataSegmentLength",}, - {"MaxAHSLength",}, - {"TaggedBufferForSolicitedDataOnly",}, - {"iSERHelloRequired",}, - {NULL,}, + { .name = "InitiatorName",}, + { .name = "InitiatorAlias",}, + { .name = "SessionType",}, + { .name = "TargetName",}, + { .name = "InitiatorRecvDataSegmentLength",}, + { .name = "MaxAHSLength",}, + { .name = "TaggedBufferForSolicitedDataOnly",}, + { .name = "iSERHelloRequired",}, + { .name = NULL,}, }; char *text_key_find(struct connection *conn, const char *searchKey) diff --git a/iscsi-scst/usr/misc.c b/iscsi-scst/usr/misc.c index c81ad40d2..465a1e094 100644 --- a/iscsi-scst/usr/misc.c +++ b/iscsi-scst/usr/misc.c @@ -25,7 +25,7 @@ #include "iscsid.h" -int driver_major(const char *dev) +static int driver_major(const char *dev) { FILE *f; char devname[256]; diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 8375281e0..3bf96a32b 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2945,6 +2945,9 @@ static bool vdisk_parse_offset(struct vdisk_cmd_params *p, struct scst_cmd *cmd) TRACE(TRACE_ORDER, "HQ cmd %p (op %s)", cmd, scst_get_opcode_name(cmd)); break; + case SCST_CMD_QUEUE_ACA: + case SCST_CMD_QUEUE_SIMPLE: + case SCST_CMD_QUEUE_UNTAGGED: default: break; } diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 1c9c838bb..96764683d 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -5136,6 +5136,7 @@ int scst_tgt_dev_setup_threads(struct scst_tgt_dev *tgt_dev) tgtt->threads_num); break; } + case SCST_THREADS_POOL_TYPE_INVALID: default: PRINT_CRIT_ERROR("Unknown threads pool type %d (dev %s)", dev->threads_pool_type, dev->virt_name); @@ -9265,6 +9266,9 @@ static int scst_do_dif(struct scst_cmd *cmd, res = generate_fn(cmd); break; + case SCST_DIF_CHECK_APP_TAG: + case SCST_DIF_CHECK_GUARD_TAG: + case SCST_DIF_CHECK_REF_TAG: default: EXTRACHECKS_BUG_ON(1); /* go through */ diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index bf5d3637b..ed2803ec7 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -2512,6 +2512,7 @@ static int scst_groups_addr_method_show(struct seq_file *seq, void *v) case SCST_LUN_ADDR_METHOD_LUN: seq_printf(seq, "%s\n", "LUN"); break; + case SCST_LUN_ADDR_METHOD_EXTENDED_LUN: default: seq_printf(seq, "%s\n", "UNKNOWN"); break; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 10cc62657..29db7baf7 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -906,6 +906,7 @@ active: scst_schedule_tasklet(cmd); break; + case SCST_CONTEXT_SAME: default: PRINT_ERROR("Context %x is undefined, using the thread one", pref_context); @@ -1904,6 +1905,7 @@ static void scst_process_redirect_cmd(struct scst_cmd *cmd, scst_schedule_tasklet(cmd); break; + case SCST_CONTEXT_SAME: default: PRINT_ERROR("Context %x is unknown, using the thread one", context); diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index a488230df..dce6122de 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -1757,6 +1757,9 @@ int scst_tg_set_group_info(struct scst_cmd *cmd) case SCST_TG_STATE_UNAVAILABLE: case SCST_TG_STATE_OFFLINE: break; + case SCST_TG_STATE_LBA_DEPENDENT: + case SCST_TG_STATE_TRANSITIONING: + case SCST_TG_STATE_UNDEFINED: default: TRACE_MGMT_DBG("Incorrect new state %d", osi[j].new_state); res = -EINVAL;