diff --git a/emulator/bthost.c b/emulator/bthost.c
index 7ccef9c..b324de0 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
return NULL;
}
-static void bthost_add_l2cap_conn(struct bthost *bthost, struct btconn *conn,
+static struct l2conn *bthost_add_l2cap_conn(struct bthost *bthost,
+ struct btconn *conn,
uint16_t scid, uint16_t dcid,
uint16_t psm)
{
l2conn = malloc(sizeof(*l2conn));
if (!l2conn)
- return;
+ return NULL;
memset(l2conn, 0, sizeof(*l2conn));
l2conn->next = conn->l2conns;
conn->l2conns = l2conn;
+
+ return l2conn;
}
static struct l2conn *btconn_find_l2cap_conn_by_scid(struct btconn *conn,
struct l2cap_conn_cb_data *cb_data;
struct l2conn *l2conn;
- bthost_add_l2cap_conn(bthost, conn, le16_to_cpu(rsp.dcid),
+ l2conn = bthost_add_l2cap_conn(bthost, conn,
+ le16_to_cpu(rsp.dcid),
le16_to_cpu(rsp.scid),
le16_to_cpu(psm));
&conf_req, sizeof(conf_req));
cb_data = bthost_find_l2cap_cb_by_psm(bthost, psm);
- l2conn = btconn_find_l2cap_conn_by_scid(conn,
- le16_to_cpu(rsp.scid));
-
if (cb_data && l2conn->psm == cb_data->psm && cb_data->func)
cb_data->func(conn->handle, l2conn->dcid,
cb_data->user_data);