Bluetooth: Use ERR_PTR as return error from hci_connect
[pandora-kernel.git] / net / bluetooth / sco.c
index c9348dd..42fdffd 100644 (file)
@@ -190,20 +190,21 @@ static int sco_connect(struct sock *sk)
 
        hci_dev_lock_bh(hdev);
 
-       err = -ENOMEM;
-
        if (lmp_esco_capable(hdev) && !disable_esco)
                type = ESCO_LINK;
        else
                type = SCO_LINK;
 
        hcon = hci_connect(hdev, type, dst, BT_SECURITY_LOW, HCI_AT_NO_BONDING);
-       if (!hcon)
+       if (IS_ERR(hcon)) {
+               err = PTR_ERR(hcon);
                goto done;
+       }
 
        conn = sco_conn_add(hcon, 0);
        if (!conn) {
                hci_conn_put(hcon);
+               err = -ENOMEM;
                goto done;
        }