]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Refactor l2cap_connect_cfm
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 7 Aug 2014 19:56:46 +0000 (22:56 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 14 Aug 2014 06:49:13 +0000 (08:49 +0200)
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>
net/bluetooth/l2cap_core.c

index 54cbfcd4da44e6e3d6d7f92e5cf34a5907664bf9..7a5cff89b79287e2eaf31f2109c027f2ac4ca5d7 100644 (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);
 
-       if (!status) {
-               conn = l2cap_conn_add(hcon);
-               if (conn)
-                       l2cap_conn_ready(conn);
-       } else {
+       if (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)