diff --git a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp index ff389c9f815..8a52467db00 100644 --- a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp +++ b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp @@ -392,7 +392,7 @@ class HCIDriver : public CordioHCIDriver { { uint16_t cmd_len = service_pack_ptr[service_pack_index + 2]; uint16_t cmd_opcode = (service_pack_ptr[service_pack_index + 1] << 8) | service_pack_ptr[service_pack_index + 0]; - uint8_t *pBuf = hciCmdAlloc(cmd_opcode, cmd_len); + uint8_t *pBuf = hciCmdAlloc(cmd_opcode, cmd_len); if (pBuf) { memcpy(pBuf + HCI_CMD_HDR_LEN, service_pack_ptr + service_pack_index + HCI_CMD_HDR_LEN, cmd_len); inject_bdaddr(pBuf); @@ -407,9 +407,9 @@ class HCIDriver : public CordioHCIDriver { if (cmd_opcode != opcode) { // DO something in case of error - - while (true); - + + return; + } // update service pack index