Bluetooth: Propagate SMP & L2CAP init failures
Checking error returned by L2CAP & SMP allows to fail Bluetooth initialization in case something goes wrong. Change-Id: Ie1c796eb64bcdee0f9dc99638c79fd4d7c05e456 Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
82fddc9cbc
commit
a7de88f972
3 changed files with 16 additions and 5 deletions
|
@ -1396,9 +1396,12 @@ int bt_init(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
bt_l2cap_init();
|
||||
err = hci_init();
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return hci_init();
|
||||
return bt_l2cap_init();
|
||||
}
|
||||
|
||||
int bt_start_advertising(uint8_t type, const struct bt_eir *ad,
|
||||
|
|
|
@ -346,15 +346,23 @@ void bt_l2cap_update_conn_param(struct bt_conn *conn)
|
|||
bt_l2cap_send(conn, BT_L2CAP_CID_LE_SIG, buf);
|
||||
}
|
||||
|
||||
void bt_l2cap_init(void)
|
||||
int bt_l2cap_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
static struct bt_l2cap_chan chan = {
|
||||
.cid = BT_L2CAP_CID_LE_SIG,
|
||||
.recv = le_sig,
|
||||
};
|
||||
|
||||
bt_att_init();
|
||||
bt_smp_init();
|
||||
|
||||
err = bt_smp_init();
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
bt_l2cap_chan_register(&chan);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -106,4 +106,4 @@ void bt_l2cap_recv(struct bt_conn *conn, struct bt_buf *buf);
|
|||
void bt_l2cap_update_conn_param(struct bt_conn *conn);
|
||||
|
||||
/* Initialize L2CAP and supported channels */
|
||||
void bt_l2cap_init(void);
|
||||
int bt_l2cap_init(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue