Skip to content

Commit 27c7cea

Browse files
committed
kernel: msgq: return once to simplify tracing
Return once simplifying tracing macros. Signed-off-by: Anas Nashif <[email protected]>
1 parent 2aca4ef commit 27c7cea

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

kernel/msg_q.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ int z_impl_k_msgq_alloc_init(struct k_msgq *msgq, size_t msg_size,
8989
}
9090

9191
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_msgq, alloc_init, msgq, ret);
92-
9392
return ret;
9493
}
9594

@@ -106,22 +105,22 @@ int z_vrfy_k_msgq_alloc_init(struct k_msgq *msgq, size_t msg_size,
106105

107106
int k_msgq_cleanup(struct k_msgq *msgq)
108107
{
108+
int ret = 0;
109109
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_msgq, cleanup, msgq);
110110

111111
CHECKIF(z_waitq_head(&msgq->wait_q) != NULL) {
112-
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_msgq, cleanup, msgq, -EBUSY);
113-
114-
return -EBUSY;
112+
ret = -EBUSY;
113+
goto exit;
115114
}
116115

117116
if ((msgq->flags & K_MSGQ_FLAG_ALLOC) != 0U) {
118117
k_free(msgq->buffer_start);
119118
msgq->flags &= ~K_MSGQ_FLAG_ALLOC;
120119
}
121120

122-
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_msgq, cleanup, msgq, 0);
123-
124-
return 0;
121+
exit:
122+
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_msgq, cleanup, msgq, ret);
123+
return ret;
125124
}
126125

127126
static inline int put_msg_in_queue(struct k_msgq *msgq, const void *data,

0 commit comments

Comments
 (0)