From a3d37e3f498b9cab3151b50c5ebd18afce17fd4b Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 18 Jun 2025 01:52:49 +0700 Subject: [PATCH] lib: smf: correct redundant ctx->executing assignment Removed duplicate assignment of ctx->executing under CONFIG_SMF_ANCESTOR_SUPPORT. Also replaced #ifndef with #ifdef to align with the positive logic used elsewhere in this file. Signed-off-by: Pisit Sawangvonganan --- lib/smf/smf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/smf/smf.c b/lib/smf/smf.c index 0205991d894..6639779bf04 100644 --- a/lib/smf/smf.c +++ b/lib/smf/smf.c @@ -400,14 +400,6 @@ int32_t smf_run_state(struct smf_ctx *const ctx) #ifdef CONFIG_SMF_ANCESTOR_SUPPORT ctx->executing = ctx->current; -#endif - -#ifndef CONFIG_SMF_ANCESTOR_SUPPORT - if (ctx->current->run) { - ctx->current->run(ctx); - } -#else - ctx->executing = ctx->current; if (ctx->current->run) { enum smf_state_result rc = ctx->current->run(ctx); @@ -419,6 +411,10 @@ int32_t smf_run_state(struct smf_ctx *const ctx) if (smf_execute_ancestor_run_actions(ctx)) { return ctx->terminate_val; } +#else + if (ctx->current->run) { + ctx->current->run(ctx); + } #endif return 0; }