Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[muen/linux.git] / net / bluetooth / hci_sock.c
index 65228bfa44872113f9a28586463bee1e7f9ca945..d32077b284337ff4086701b0fa5817a173e09d03 100644 (file)
@@ -831,8 +831,6 @@ static int hci_sock_release(struct socket *sock)
        if (!sk)
                return 0;
 
-       hdev = hci_pi(sk)->hdev;
-
        switch (hci_pi(sk)->channel) {
        case HCI_CHANNEL_MONITOR:
                atomic_dec(&monitor_promisc);
@@ -854,6 +852,7 @@ static int hci_sock_release(struct socket *sock)
 
        bt_sock_unlink(&hci_sk_list, sk);
 
+       hdev = hci_pi(sk)->hdev;
        if (hdev) {
                if (hci_pi(sk)->channel == HCI_CHANNEL_USER) {
                        /* When releasing a user channel exclusive access,