Skip to content

Commit

Permalink
kernel: Fix bug in dynamic alert initialization
Browse files Browse the repository at this point in the history
k_alert_init() needs to set the "flags" field of its associated
work item to zero, indicating that the work item has not yet
been submitted to the system workqueue. Using the standard work
item initializer macro ensures this is done correctly.

Change-Id: I0001a5920f20fb1d8dc182191e6a549c5bf89be5
Signed-off-by: Allan Stephens <[email protected]>
  • Loading branch information
ajstephens authored and Anas Nashif committed Nov 11, 2016
1 parent dd6f9ca commit 3cd7020
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions kernel/unified/alert.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,9 @@ void _alert_deliver(struct k_work *work)
void k_alert_init(struct k_alert *alert, k_alert_handler_t handler,
unsigned int max_num_pending_alerts)
{
const struct k_work my_work_item = {
NULL, _alert_deliver, { max_num_pending_alerts }
};

alert->handler = handler;
alert->send_count = ATOMIC_INIT(0);
alert->work_item = my_work_item;
alert->work_item = (struct k_work)K_WORK_INITIALIZER(_alert_deliver);
k_sem_init(&alert->sem, 0, max_num_pending_alerts);
SYS_TRACING_OBJ_INIT(k_alert, alert);
}
Expand Down

0 comments on commit 3cd7020

Please sign in to comment.