Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08a12fd9 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Add return condition to stack/l2cap/l2c_ble::l2cble_conn_comp am: 7ed9f6ae

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1456345

Change-Id: I344078b46371b9100b22c81b58d201586227c249
parents c72d70bd 7ed9f6ae
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29,12 +29,12 @@ extern bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason);
extern void l2c_link_role_changed(const RawAddress* bd_addr, uint8_t new_role,
                                  uint8_t hci_status);

extern void l2cble_conn_comp(uint16_t handle, uint8_t role,
extern bool l2cble_conn_comp(uint16_t handle, uint8_t role,
                             const RawAddress& bda, tBLE_ADDR_TYPE type,
                             uint16_t conn_interval, uint16_t conn_latency,
                             uint16_t conn_timeout);

extern void l2cble_conn_comp_from_address_with_type(
extern bool l2cble_conn_comp_from_address_with_type(
    uint16_t handle, uint8_t role, const tBLE_BD_ADDR& address_with_type,
    uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout);

+9 −7
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ void l2cble_notify_le_connection(const RawAddress& bda) {

/** This function is called when an HCI Connection Complete event is received.
 */
void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
bool l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
                      tBLE_ADDR_TYPE type, uint16_t conn_interval,
                      uint16_t conn_latency, uint16_t conn_timeout) {
  // role == HCI_ROLE_MASTER => scanner completed connection
@@ -281,19 +281,19 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
    if (!p_lcb) {
      btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
      LOG_ERROR("Unable to allocate link resource for le acl connection");
      return;
      return false;
    } else {
      if (!l2cu_initialize_fixed_ccb(p_lcb, L2CAP_ATT_CID)) {
        btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
        LOG_ERROR("Unable to allocate channel resource for le acl connection");
        return;
        return false;
      }
    }
  } else if (role == HCI_ROLE_MASTER && p_lcb->link_state != LST_CONNECTING) {
    LOG_ERROR(
        "Received le acl connection as role master but not in connecting "
        "state");
    return;
    return false;
  }

  if (role == HCI_ROLE_MASTER) alarm_cancel(p_lcb->l2c_lcb_timer);
@@ -333,13 +333,15 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
      l2cu_process_fixed_chnl_resp(p_lcb);
    }
  }
  return true;
}

void l2cble_conn_comp_from_address_with_type(
bool l2cble_conn_comp_from_address_with_type(
    uint16_t handle, uint8_t role, const tBLE_BD_ADDR& address_with_type,
    uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout) {
  l2cble_conn_comp(handle, role, address_with_type.bda, address_with_type.type,
                   conn_interval, conn_latency, conn_timeout);
  return l2cble_conn_comp(handle, role, address_with_type.bda,
                          address_with_type.type, conn_interval, conn_latency,
                          conn_timeout);
}

/*******************************************************************************