Commit 55a988ef authored by Chun-Chieh Li's avatar Chun-Chieh Li Committed by Anas Nashif
Browse files

lib: smf: fix ctx->executing in smf_execute_all_entry_actions



Fix ctx->executing is not updated in smf_execute_all_entry_actions()

Signed-off-by: default avatarChun-Chieh Li <ccli8@nuvoton.com>
parent eae09001
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -98,12 +98,12 @@ static bool smf_execute_all_entry_actions(struct smf_ctx *const ctx,
	for (const struct smf_state *to_execute = get_child_of(new_state, topmost);
	     to_execute != NULL && to_execute != new_state;
	     to_execute = get_child_of(new_state, to_execute)) {
		/* Execute every entry action EXCEPT that of the topmost state */
		if (to_execute->entry) {
		/* Keep track of the executing entry action in case it calls
			 * smf_set_State()
		 * smf_set_state()
		 */
		ctx->executing = to_execute;
		/* Execute every entry action EXCEPT that of the topmost state */
		if (to_execute->entry) {
			to_execute->entry(ctx);

			/* No need to continue if terminate was set */
@@ -114,6 +114,7 @@ static bool smf_execute_all_entry_actions(struct smf_ctx *const ctx,
	}

	/* and execute the new state entry action */
	ctx->executing = new_state;
	if (new_state->entry) {
		new_state->entry(ctx);