From 533d5546b0f9a4ca9097b0def859072ddfc8b9ad Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 20 Jun 2014 04:09:11 +0000 Subject: [PATCH] scst: Avoid that sparse complains about unreachable code Remove the code after BUG() statements to avoid that smatch complains about unreachable code. Hide the spin_unlock() statements before BUG() statements for static analysis tools to avoid that sparse complains about locking imbalances. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5617 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_user.c | 1 - scst/src/scst_targ.c | 16 ++++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index e2cf60d26..4610f78e8 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -826,7 +826,6 @@ static int dev_user_parse(struct scst_cmd *cmd) default: sBUG(); - goto out; } done: diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 4a17c090e..33e2237f6 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1697,7 +1697,6 @@ static int scst_tgt_pre_exec(struct scst_cmd *cmd) goto out; default: sBUG(); - goto out; } } @@ -4869,12 +4868,10 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic) default: PRINT_CRIT_ERROR("cmd %p is in invalid state %d)", cmd, cmd->state); +#if !defined(__CHECKER__) spin_unlock_irq(&cmd->cmd_threads->cmd_list_lock); - sBUG(); -#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 < 6 - spin_lock_irq(&cmd->cmd_threads->cmd_list_lock); - break; #endif + sBUG(); } #endif wake_up(&cmd->cmd_threads->cmd_list_waitQ); @@ -5484,15 +5481,15 @@ static int scst_set_mcmd_next_state(struct scst_mgmt_cmd *mcmd) "cmd_finish_wait_count %d, cmd_done_wait_count %d)", mcmd, mcmd->state, mcmd->fn, mcmd->cmd_finish_wait_count, mcmd->cmd_done_wait_count); +#if !defined(__CHECKER__) spin_unlock_irq(&scst_mcmd_lock); +#endif res = -1; sBUG(); - goto out; } spin_unlock_irq(&scst_mcmd_lock); -out: return res; } @@ -6509,11 +6506,6 @@ static int scst_process_mgmt_cmd(struct scst_mgmt_cmd *mcmd) mcmd->cmd_finish_wait_count, mcmd->cmd_done_wait_count); sBUG(); -#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 < 6 - /* For suppressing a gcc compiler warning */ - res = -1; - goto out; -#endif } }