diff options
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index ea68d3219b7e..d0f36336b6ce 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -7128,7 +7128,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, | |||
7128 | chan->dcid = cid; | 7128 | chan->dcid = cid; |
7129 | 7129 | ||
7130 | if (bdaddr_type_is_le(dst_type)) { | 7130 | if (bdaddr_type_is_le(dst_type)) { |
7131 | bool master; | 7131 | u8 role; |
7132 | 7132 | ||
7133 | /* Convert from L2CAP channel address type to HCI address type | 7133 | /* Convert from L2CAP channel address type to HCI address type |
7134 | */ | 7134 | */ |
@@ -7137,10 +7137,13 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, | |||
7137 | else | 7137 | else |
7138 | dst_type = ADDR_LE_DEV_RANDOM; | 7138 | dst_type = ADDR_LE_DEV_RANDOM; |
7139 | 7139 | ||
7140 | master = !test_bit(HCI_ADVERTISING, &hdev->dev_flags); | 7140 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) |
7141 | role = HCI_ROLE_SLAVE; | ||
7142 | else | ||
7143 | role = HCI_ROLE_MASTER; | ||
7141 | 7144 | ||
7142 | hcon = hci_connect_le(hdev, dst, dst_type, chan->sec_level, | 7145 | hcon = hci_connect_le(hdev, dst, dst_type, chan->sec_level, |
7143 | HCI_LE_CONN_TIMEOUT, master); | 7146 | HCI_LE_CONN_TIMEOUT, role); |
7144 | } else { | 7147 | } else { |
7145 | u8 auth_type = l2cap_get_auth_type(chan); | 7148 | u8 auth_type = l2cap_get_auth_type(chan); |
7146 | hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type); | 7149 | hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type); |