Bluetooth: Refactor l2cap_connect_cfm

This patch is a simple refactoring of l2cap_connect_cfm to allow easier
extension of the function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Johan Hedberg 2014-08-07 22:56:46 +03:00 committed by Marcel Holtmann
parent 191eb398c6
commit dc0f508818

View file

@ -7268,13 +7268,16 @@ void l2cap_connect_cfm(struct hci_conn *hcon, u8 status)
BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status);
if (!status) { if (status) {
conn = l2cap_conn_add(hcon);
if (conn)
l2cap_conn_ready(conn);
} else {
l2cap_conn_del(hcon, bt_to_errno(status)); l2cap_conn_del(hcon, bt_to_errno(status));
return;
} }
conn = l2cap_conn_add(hcon);
if (!conn)
return;
l2cap_conn_ready(conn);
} }
int l2cap_disconn_ind(struct hci_conn *hcon) int l2cap_disconn_ind(struct hci_conn *hcon)