Bluetooth: Use ERR_PTR as return error from hci_connect
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / bluetooth / sco.c
index c9348ddda877cdfb9ba182cbfd9889572969ff91..42fdffd1d76c0c17c5ab3382b94ea5bf4fcc62c9 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;
        }