kernel: fatal: Remove redundant function

We don't need re-implement a function to get the current cpu.
Simply use _current_cpu that even contains additional sanity checks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2023-09-28 16:21:06 -07:00 committed by Carles Cufí
commit 121d051c9a

View file

@ -84,15 +84,6 @@ FUNC_NORETURN void k_fatal_halt(unsigned int reason)
}
/* LCOV_EXCL_STOP */
static inline int get_cpu(void)
{
#if defined(CONFIG_SMP)
return arch_curr_cpu()->id;
#else
return 0;
#endif
}
void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
{
/* We can't allow this code to be preempted, but don't need to
@ -107,7 +98,7 @@ void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
* change it without also updating twister
*/
LOG_ERR(">>> ZEPHYR FATAL ERROR %d: %s on CPU %d", reason,
reason_to_str(reason), get_cpu());
reason_to_str(reason), _current_cpu->id);
/* FIXME: This doesn't seem to work as expected on all arches.
* Need a reliable way to determine whether the fault happened when