Skip to content

Commit 0b3ec11

Browse files
vlad-kulikovnashif
authored andcommitted
smf: make while conditions MISRA 14.4 compliant
Replace pointer-as-condition checks, with explicit != NULL comparisons. Which satisfies MISRA-C:2012 Rule 14.4 (controlling expressions shall be essentially Boolean). Signed-off-by: Vladislav Kulikov <[email protected]>
1 parent 76c1d71 commit 0b3ec11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/smf/smf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void smf_set_initial(struct smf_ctx *const ctx, const struct smf_state *init_sta
236236
* The final target will be the deepest leaf state that
237237
* the target contains. Set that as the real target.
238238
*/
239-
while (init_state->initial) {
239+
while (init_state->initial != NULL) {
240240
init_state = init_state->initial;
241241
}
242242
#endif
@@ -346,7 +346,7 @@ void smf_set_state(struct smf_ctx *const ctx, const struct smf_state *new_state)
346346
* The final target will be the deepest leaf state that
347347
* the target contains. Set that as the real target.
348348
*/
349-
while (new_state->initial) {
349+
while (new_state->initial != NULL) {
350350
new_state = new_state->initial;
351351
}
352352
#endif

0 commit comments

Comments
 (0)