Skip to content

Commit

Permalink
Fix Misra 17.8: can't mod function params
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed Nov 20, 2019
1 parent bc685ac commit d58d08f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,20 @@ void EXTI3_IRQHandler(void) {

// this is the only way to leave silent mode
void set_safety_mode(uint16_t mode, int16_t param) {
int err = set_safety_hooks(mode, param);
uint16_t mode_copy = mode;
int err = set_safety_hooks(mode_copy, param);
if (err == -1) {
puts("Error: safety set mode failed. Falling back to SILENT\n");
mode = SAFETY_SILENT;
err = set_safety_hooks(mode, 0);
mode_copy = SAFETY_SILENT;
err = set_safety_hooks(mode_copy, 0);
if (err == -1) {
puts("Error: Failed setting SILENT mode. Hanging\n");
while (true) {
// TERMINAL ERROR: we can't continue if SILENT safety mode isn't succesfully set
}
}
}
switch (mode) {
switch (mode_copy) {
case SAFETY_SILENT:
set_intercept_relay(false);
if (board_has_obd()) {
Expand Down

0 comments on commit d58d08f

Please sign in to comment.