mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-19 05:36:22 +00:00
scst: Avoid that smatch complains about dead code
The panic() function that implements BUG() has been declared with attribute noreturn in some RHEL 5 kernel headers and also in the RHEL 6 kernel headers. Smatch warns about dead code if any code follows a function that has been declared with attribute noreturn. Hence add a few preprocessor statements to suppress the smatch warning when building against an upstream kernel or when building against RHEL 6 or later. Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5466 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2952,8 +2952,10 @@ int scst_get_cmd_abnormal_done_state(const struct scst_cmd *cmd)
|
||||
PRINT_CRIT_ERROR("Wrong cmd state %d (cmd %p, op %x)",
|
||||
cmd->state, cmd, cmd->cdb[0]);
|
||||
sBUG();
|
||||
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 < 6
|
||||
/* Invalid state to suppress a compiler warning */
|
||||
res = SCST_CMD_STATE_LAST_ACTIVE;
|
||||
#endif
|
||||
}
|
||||
|
||||
TRACE_EXIT_RES(res);
|
||||
|
||||
@@ -4787,8 +4787,11 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
PRINT_CRIT_ERROR("cmd (%p) in state %d, but shouldn't "
|
||||
"be", cmd, cmd->state);
|
||||
sBUG();
|
||||
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 < 6
|
||||
/* For suppressing a gcc compiler warning */
|
||||
res = SCST_CMD_STATE_RES_CONT_NEXT;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
} while (res == SCST_CMD_STATE_RES_CONT_SAME);
|
||||
|
||||
@@ -4820,8 +4823,10 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
cmd->state);
|
||||
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
|
||||
}
|
||||
#endif
|
||||
wake_up(&cmd->cmd_threads->cmd_list_waitQ);
|
||||
@@ -6419,8 +6424,11 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user