if (conn)
return ERR_PTR(-EBUSY);
- /* Convert from L2CAP channel address type to HCI address type */
- if (dst_type == BDADDR_LE_PUBLIC)
- dst_type = ADDR_LE_DEV_PUBLIC;
- else
- dst_type = ADDR_LE_DEV_RANDOM;
-
/* When given an identity address with existing identity
* resolving key, the connection needs to be established
* to a resolvable random address.
auth_type = l2cap_get_auth_type(chan);
- if (bdaddr_type_is_le(dst_type))
+ if (bdaddr_type_is_le(dst_type)) {
+ /* Convert from L2CAP channel address type to HCI address type
+ */
+ if (dst_type == BDADDR_LE_PUBLIC)
+ dst_type = ADDR_LE_DEV_PUBLIC;
+ else
+ dst_type = ADDR_LE_DEV_RANDOM;
+
hcon = hci_connect_le(hdev, dst, dst_type, chan->sec_level,
auth_type);
- else
+ } else {
hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type);
+ }
if (IS_ERR(hcon)) {
err = PTR_ERR(hcon);
else
auth_type = HCI_AT_DEDICATED_BONDING_MITM;
- if (cp->addr.type == BDADDR_BREDR)
+ if (cp->addr.type == BDADDR_BREDR) {
conn = hci_connect_acl(hdev, &cp->addr.bdaddr, sec_level,
auth_type);
- else
- conn = hci_connect_le(hdev, &cp->addr.bdaddr, cp->addr.type,
+ } else {
+ u8 addr_type;
+
+ /* Convert from L2CAP channel address type to HCI address type
+ */
+ if (cp->addr.type == BDADDR_LE_PUBLIC)
+ addr_type = ADDR_LE_DEV_PUBLIC;
+ else
+ addr_type = ADDR_LE_DEV_RANDOM;
+
+ conn = hci_connect_le(hdev, &cp->addr.bdaddr, addr_type,
sec_level, auth_type);
+ }
if (IS_ERR(conn)) {
int status;