diff --git a/module/system_coordinator/src/mod_system_coordinator.c b/module/system_coordinator/src/mod_system_coordinator.c index 405b2ac53376a8fe92dc9d30fcf692faeb2f22bc..fba13a3e0735c33dc99a0008250f1edbe56dd728 100644 --- a/module/system_coordinator/src/mod_system_coordinator.c +++ b/module/system_coordinator/src/mod_system_coordinator.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -86,7 +86,7 @@ static int send_phase_event(struct phase_event_params *params) status = fwk_put_event(&phase_event); if (status != FWK_SUCCESS) { FWK_LOG_ERR( - MOD_NAME "%s@%" PRIu32 " status=%" PRIu32 ", phase_idx=%" PRIu32 "", + MOD_NAME "%s@%u status=%u, phase_idx=%u", __func__, __LINE__, status, @@ -148,20 +148,22 @@ static int process_current_phase(const struct phase_event_params *params) phase_ctx = &system_coordinator_ctx.phase_ctx[params->phase_idx]; next_phase_params.phase_idx = params->phase_idx + 1; next_phase_params.cycle_count = params->cycle_count; + if (next_phase_params.phase_idx < system_coordinator_ctx.phase_count) { + if (phase_ctx->phase_config->phase_us == 0) { + /* Send event to process next phase if current phase timer is 0 */ + status = send_phase_event(&next_phase_params); + } else if ( + params->phase_idx <= (system_coordinator_ctx.phase_count - 1)) { + /* + * Start timer for next phase. Timer will be skip if the phase is + * the last phase or the phase time value is 0. + */ + status = start_timer_for_next_phase(phase_ctx, &next_phase_params); + } - if (phase_ctx->phase_config->phase_us == 0) { - /* Send event to process next phase if current phase timer is 0 */ - status = send_phase_event(&next_phase_params); - } else if (params->phase_idx < (system_coordinator_ctx.phase_count - 1)) { - /* - * Start timer for next phase. Timer will be skip if the phase is the - * last phase or the phase time value is 0. - */ - status = start_timer_for_next_phase(phase_ctx, &next_phase_params); - } - - if (status != FWK_SUCCESS) { - return status; + if (status != FWK_SUCCESS) { + return status; + } } /* Call phase API */