From d58d08fbbf0fd5a6a0a0185b7ede8dee2bfc5ac4 Mon Sep 17 00:00:00 2001 From: Riccardo Date: Wed, 20 Nov 2019 15:13:26 -0800 Subject: [PATCH] Fix Misra 17.8: can't mod function params --- board/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/board/main.c b/board/main.c index a5bfe9b23028e2..ed305c1aeabbba 100644 --- a/board/main.c +++ b/board/main.c @@ -115,11 +115,12 @@ 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) { @@ -127,7 +128,7 @@ void set_safety_mode(uint16_t mode, int16_t param) { } } } - switch (mode) { + switch (mode_copy) { case SAFETY_SILENT: set_intercept_relay(false); if (board_has_obd()) {