arch: xtensa: Remove unecessary logic in backtrace

In z_xtensa_backtrace_print the parameter depth is checked for <= 0.
There is no need to check it again later, also, since the variable is
not used after the while loop we can use directly the parameter without
an additional variable.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2023-05-12 18:18:53 +00:00 committed by Anas Nashif
parent 15a3f8c7e7
commit c4025f026f

View file

@ -108,9 +108,7 @@ int z_xtensa_backtrace_print(int depth, int *interrupted_stack)
/* Ignore the first corrupted PC in case of InstrFetchProhibited */
cause == EXCCAUSE_INSTR_PROHIBITED));
uint32_t i = (depth <= 0) ? INT32_MAX : depth;
while (i-- > 0 && stk_frame.next_pc != 0 && !corrupted) {
while (depth-- > 0 && stk_frame.next_pc != 0 && !corrupted) {
/* Get previous stack frame */
if (!z_xtensa_backtrace_get_next_frame(&stk_frame)) {
corrupted = true;