Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
struct bt_notification_inactivity *notification;
struct bt_notification *ret_notif = NULL;
- if (!cc_prio_map) {
- BT_LOGW_STR("Invalid parameter: clock class priority map is NULL.");
- goto error;
+ if (cc_prio_map) {
+ /* Function's reference, released at the end */
+ bt_get(cc_prio_map);
+ } else {
+ cc_prio_map = bt_clock_class_priority_map_create();
+ if (!cc_prio_map) {
+ BT_LOGE_STR("Cannot create empty clock class priority map.");
+ goto error;
+ }
}
BT_LOGD("Creating inactivity notification object: "
BT_PUT(ret_notif);
end:
+ bt_put(cc_prio_map);
return ret_notif;
}