]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/bluetooth/mgmt.c
Bluetooth: Log all parameters in cmd_status for easier debugging
[karo-tx-linux.git] / net / bluetooth / mgmt.c
index 16c7a4d0432c52605317b9999abde10b3ed050e6..e6efaae764b38fd2c81826516061ad0f3ec6dc9d 100644 (file)
@@ -49,7 +49,7 @@ static int cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status)
        struct mgmt_hdr *hdr;
        struct mgmt_ev_cmd_status *ev;
 
-       BT_DBG("sock %p", sk);
+       BT_DBG("sock %p, index %u, cmd %u, status %u", sk, index, cmd, status);
 
        skb = alloc_skb(sizeof(*hdr) + sizeof(*ev), GFP_ATOMIC);
        if (!skb)
@@ -92,7 +92,9 @@ static int cmd_complete(struct sock *sk, u16 index, u16 cmd, void *rp,
 
        ev = (void *) skb_put(skb, sizeof(*ev) + rp_len);
        put_unaligned_le16(cmd, &ev->opcode);
-       memcpy(ev->data, rp, rp_len);
+
+       if (rp)
+               memcpy(ev->data, rp, rp_len);
 
        if (sock_queue_rcv_skb(sk, skb) < 0)
                kfree_skb(skb);
@@ -1171,8 +1173,8 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len)
        }
 
        conn = hci_connect(hdev, ACL_LINK, &cp->bdaddr, sec_level, auth_type);
-       if (!conn) {
-               err = -ENOMEM;
+       if (IS_ERR(conn)) {
+               err = PTR_ERR(conn);
                goto unlock;
        }