Bluetooth: host: Guard calls to bt_conn functions
Guard calls to bt_conn functions in bt_le_adv_start_internal with IS_ENABLED(CONFIG_BT_PERIPHERAL) to avoid undefined symbols in builds that do not support that role. Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
This commit is contained in:
parent
d3314851df
commit
dbdfd2995b
1 changed files with 2 additions and 2 deletions
|
@ -5957,14 +5957,14 @@ int bt_le_adv_start_internal(const struct bt_le_adv_param *param,
|
||||||
err = set_advertise_enable(true);
|
err = set_advertise_enable(true);
|
||||||
if (err) {
|
if (err) {
|
||||||
BT_ERR("Failed to start advertiser");
|
BT_ERR("Failed to start advertiser");
|
||||||
if (conn) {
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn) {
|
||||||
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
|
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
|
||||||
bt_conn_unref(conn);
|
bt_conn_unref(conn);
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn) {
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn) {
|
||||||
/* If undirected connectable advertiser we have created a
|
/* If undirected connectable advertiser we have created a
|
||||||
* connection object that we don't yet give to the application.
|
* connection object that we don't yet give to the application.
|
||||||
* Since we don't give the application a reference to manage in
|
* Since we don't give the application a reference to manage in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue