Skip to content

Commit

Permalink
logging: Set panic_mode flag after flushing in log_panic
Browse files Browse the repository at this point in the history
In case log_panic is called from context which can be
interrupted, it is safer to set panic_mode flag after
logs are flushed. If flag was set before flushing and
log_panic was interrupted then another context was
attempting to process log message directly, competing
for log backends.

Signed-off-by: Krzysztof Chruscinski <[email protected]>
  • Loading branch information
nordic-krch authored and galak committed Feb 11, 2019
1 parent 3a879de commit f81346c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/logging/log_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@ void log_panic(void)
}
}

panic_mode = true;

if (!IS_ENABLED(CONFIG_LOG_IMMEDIATE)) {
/* Flush */
while (log_process(false) == true) {
}
}

panic_mode = true;
}

static bool msg_filter_check(struct log_backend const *backend,
Expand Down

0 comments on commit f81346c

Please sign in to comment.