Merge "Allow factory reset when bluetooth is off (2/2)"
diff --git a/stack/l2cap/l2c_csm.c b/stack/l2cap/l2c_csm.c
index 21f45d3..dedffc8 100644
--- a/stack/l2cap/l2c_csm.c
+++ b/stack/l2cap/l2c_csm.c
@@ -1496,6 +1496,11 @@
         UINT16_TO_STREAM (p, p_ccb->remote_cid);
     }
 
+    if (p_ccb->xmit_hold_q == NULL) {
+      L2CAP_TRACE_ERROR("%s: empty queue: p_ccb = %p p_ccb->in_use = %d p_ccb->chnl_state = %d p_ccb->local_cid = %u p_ccb->remote_cid = %u",
+                        __func__, p_ccb, p_ccb->in_use, p_ccb->chnl_state,
+                        p_ccb->local_cid, p_ccb->remote_cid);
+    }
     fixed_queue_enqueue(p_ccb->xmit_hold_q, p_buf);
 
     l2cu_check_channel_congestion (p_ccb);
diff --git a/stack/l2cap/l2c_int.h b/stack/l2cap/l2c_int.h
index 2669f4d..54e1f03 100644
--- a/stack/l2cap/l2c_int.h
+++ b/stack/l2cap/l2c_int.h
@@ -70,7 +70,7 @@
 */
 typedef enum
 {
-    CST_CLOSED,                           /* Channel is in clodes state           */
+    CST_CLOSED,                           /* Channel is in closed state           */
     CST_ORIG_W4_SEC_COMP,                 /* Originator waits security clearence  */
     CST_TERM_W4_SEC_COMP,                 /* Acceptor waits security clearence    */
     CST_W4_L2CAP_CONNECT_RSP,             /* Waiting for peer conenct response    */
@@ -658,16 +658,6 @@
 BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data);
 #endif
 
-#if (BLE_INCLUDED == TRUE)
-extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout);
-extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id);
-#endif
-
-extern BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr);
-extern void    l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb);
-extern void    l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb);
-
-
 /* Functions provided for Broadcom Aware
 ****************************************
 */
diff --git a/stack/l2cap/l2c_utils.c b/stack/l2cap/l2c_utils.c
index b741a12..ebcd095 100644
--- a/stack/l2cap/l2c_utils.c
+++ b/stack/l2cap/l2c_utils.c
@@ -2748,11 +2748,6 @@
     p_ccb->local_cid  = fixed_cid;
     p_ccb->remote_cid = fixed_cid;
 
-    p_ccb->xmit_hold_q = fixed_queue_new(SIZE_MAX);
-    p_ccb->fcrb.srej_rcv_hold_q = fixed_queue_new(SIZE_MAX);
-    p_ccb->fcrb.retrans_q = fixed_queue_new(SIZE_MAX);
-    p_ccb->fcrb.waiting_for_ack_q = fixed_queue_new(SIZE_MAX);
-
     p_ccb->is_flushable = FALSE;
 
     if (p_fcr)