Merge tag 'media/v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[deliverable/linux.git] / net / bluetooth / l2cap_core.c
index 66e8b6ee19a525d8cc54032843934b0fedb11dc7..39a5149f301085d45d37a94361e2b86486d852bd 100644 (file)
@@ -6538,8 +6538,6 @@ static int l2cap_rx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
 static int l2cap_stream_rx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
                           struct sk_buff *skb)
 {
-       int err = 0;
-
        BT_DBG("chan %p, control %p, skb %p, state %d", chan, control, skb,
               chan->rx_state);
 
@@ -6570,7 +6568,7 @@ static int l2cap_stream_rx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
        chan->last_acked_seq = control->txseq;
        chan->expected_tx_seq = __next_seq(chan, control->txseq);
 
-       return err;
+       return 0;
 }
 
 static int l2cap_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
@@ -7113,8 +7111,6 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
        chan->dcid = cid;
 
        if (bdaddr_type_is_le(dst_type)) {
-               u8 role;
-
                /* Convert from L2CAP channel address type to HCI address type
                 */
                if (dst_type == BDADDR_LE_PUBLIC)
@@ -7123,14 +7119,15 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
                        dst_type = ADDR_LE_DEV_RANDOM;
 
                if (hci_dev_test_flag(hdev, HCI_ADVERTISING))
-                       role = HCI_ROLE_SLAVE;
+                       hcon = hci_connect_le(hdev, dst, dst_type,
+                                             chan->sec_level,
+                                             HCI_LE_CONN_TIMEOUT,
+                                             HCI_ROLE_SLAVE);
                else
-                       role = HCI_ROLE_MASTER;
+                       hcon = hci_connect_le_scan(hdev, dst, dst_type,
+                                                  chan->sec_level,
+                                                  HCI_LE_CONN_TIMEOUT);
 
-               hcon = hci_connect_le_scan(hdev, dst, dst_type,
-                                          chan->sec_level,
-                                          HCI_LE_CONN_TIMEOUT,
-                                          role);
        } else {
                u8 auth_type = l2cap_get_auth_type(chan);
                hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type);
This page took 0.02663 seconds and 5 git commands to generate.