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 <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5617 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2014-06-20 04:09:11 +00:00
parent 23116c1598
commit 533d5546b0
2 changed files with 4 additions and 13 deletions
-1
View File
@@ -826,7 +826,6 @@ static int dev_user_parse(struct scst_cmd *cmd)
default:
sBUG();
goto out;
}
done:
+4 -12
View File
@@ -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
}
}