Bluetooth: Audio: HAS: Fix active_preset_work initialization
The security_changed callback may be called before bt_has_register has been called, thus making the active_preset_work handler uninitailized, causing an ASSERT when the work is submitted in the security changed callback. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
d6055f9938
commit
ea858f26c5
1 changed files with 2 additions and 5 deletions
|
@ -135,7 +135,8 @@ static struct has_preset {
|
|||
static uint8_t has_preset_num;
|
||||
|
||||
/* Active preset notification work */
|
||||
static struct k_work active_preset_work;
|
||||
static void active_preset_work_process(struct k_work *work);
|
||||
static K_WORK_DEFINE(active_preset_work, active_preset_work_process);
|
||||
|
||||
static void process_control_point_work(struct k_work *work);
|
||||
|
||||
|
@ -1180,10 +1181,6 @@ int bt_has_register(const struct bt_has_register_param *param)
|
|||
return err;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_HAS_PRESET_SUPPORT)
|
||||
k_work_init(&active_preset_work, active_preset_work_process);
|
||||
#endif /* CONFIG_BT_HAS_PRESET_SUPPORT */
|
||||
|
||||
registered = true;
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue