Merge "Init variables to fix compiler error"
diff --git a/bta/av/bta_av_act.c b/bta/av/bta_av_act.c
index 4408874..1637adc 100644
--- a/bta/av/bta_av_act.c
+++ b/bta/av/bta_av_act.c
@@ -870,7 +870,7 @@
     BOOLEAN is_inquiry = ((p_data->rc_msg.msg.hdr.ctype == AVRC_CMD_SPEC_INQ) || p_data->rc_msg.msg.hdr.ctype == AVRC_CMD_GEN_INQ);
 #if (AVRC_METADATA_INCLUDED == TRUE)
     tAVRC_STS   res;
-    UINT8       ctype;
+    UINT8       ctype = 0;
     tAVRC_RESPONSE  rc_rsp;
 
     rc_rsp.rsp.status = BTA_AV_STS_NO_RSP;
diff --git a/bta/hl/bta_hl_utils.c b/bta/hl/bta_hl_utils.c
index 6a08b74..bc37807 100644
--- a/bta/hl/bta_hl_utils.c
+++ b/bta/hl/bta_hl_utils.c
@@ -1462,6 +1462,8 @@
     tBTA_HL_MDL_CFG     *p_mdl;
     UINT8 i ;
     BOOLEAN found=FALSE;
+
+    *p_mdl_cfg_idx = 0;
     for (i=0; i< BTA_HL_NUM_MDL_CFGS; i++)
     {
         p_mdl = BTA_HL_GET_MDL_CFG_PTR(app_idx, i);
@@ -2725,6 +2727,11 @@
         }
         success = TRUE;
     }
+    else
+    {
+      p_cfg->mtu = L2CAP_DEFAULT_MTU;
+      p_cfg->fcs = BTA_HL_L2C_NO_FCS;
+    }
 
 #if BTA_HL_DEBUG == TRUE
     if (!success)
diff --git a/btif/src/btif_hl.c b/btif/src/btif_hl.c
index cdf13b6..efa5ca7 100644
--- a/btif/src/btif_hl.c
+++ b/btif/src/btif_hl.c
@@ -189,6 +189,9 @@
     btif_hl_mcl_cb_t    *p_mcb;
     UINT8 i, j;
     BOOLEAN found=FALSE;
+
+    *p_app_idx = 0;
+    *p_mcl_idx = 0;
     for (i=0; i < BTA_HL_NUM_APPS ; i ++)
     {
         p_acb  =BTIF_HL_GET_APP_CB_PTR(i);
@@ -1002,6 +1005,8 @@
     UINT8 i,j;
     int mdl_cfg_channel_id;
 
+    *p_app_idx = 0;
+    *p_mdl_cfg_idx =0;
     for (i=0; i < BTA_HL_NUM_APPS ; i ++)
     {
         p_acb =BTIF_HL_GET_APP_CB_PTR(i);
@@ -1125,6 +1130,9 @@
     BOOLEAN found=FALSE;
     UINT8 i,j,k;
 
+    *p_app_idx = 0;
+    *p_mcl_idx =0;
+    *p_mdl_idx = 0;
     for (i=0; i < BTA_HL_NUM_APPS ; i ++)
     {
         p_acb =BTIF_HL_GET_APP_CB_PTR(i);
@@ -1324,6 +1332,7 @@
     btif_hl_app_cb_t  *p_acb =BTIF_HL_GET_APP_CB_PTR(app_idx);
     btif_hl_mcl_cb_t  *p_mcb;
 
+    *p_mcl_idx = 0;
     for (i=0; i < BTA_HL_NUM_MCLS ; i ++)
     {
         p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx, i);
@@ -1585,6 +1594,7 @@
             *p = BTA_HL_MDEP_ROLE_SINK;
             break;
         default:
+            *p = BTA_HL_MDEP_ROLE_SOURCE;
             status = FALSE;
             break;
     }
@@ -1744,6 +1754,7 @@
     BOOLEAN found=FALSE;
     UINT8 i;
 
+    *p_app_idx = 0;
     for (i=0; i < BTA_HL_NUM_APPS ; i ++)
     {
         if (btif_hl_cb.acb[i].in_use &&
@@ -2026,6 +2037,7 @@
     BOOLEAN found=FALSE;
     UINT8 i;
 
+    *p_app_idx = 0;
     for (i=0; i < BTA_HL_NUM_APPS ; i ++)
     {
         BTIF_TRACE_DEBUG1("btif_hl_find_app_idx_using_mdepId: MDEP-ID = %d",
@@ -2635,7 +2647,6 @@
     BOOLEAN                  status = FALSE;
     tBTA_HL_DCH_OPEN_PARAM   dch_open;
 
-
     BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
 
     if (btif_hl_find_app_idx_using_app_id(p_data->cch_open_cfm.app_id, &app_idx))
@@ -4131,7 +4142,7 @@
 **
 *******************************************************************************/
 static bt_status_t destroy_channel(int channel_id){
-    UINT8 app_idx, mcl_idx, mdl_idx, mdl_cfg_idx, app_id, mdep_cfg_idx;
+    UINT8 app_idx, mcl_idx, mdl_idx, mdl_cfg_idx, app_id, mdep_cfg_idx = 0;
     bt_status_t status = BT_STATUS_SUCCESS;
     btif_hl_mdl_cfg_t     *p_mdl;
     btif_hl_mcl_cb_t     *p_mcb;
diff --git a/stack/btm/btm_ble.c b/stack/btm/btm_ble.c
index 9bd771a..1f66a46 100644
--- a/stack/btm/btm_ble.c
+++ b/stack/btm/btm_ble.c
@@ -847,6 +847,7 @@
                      bd_addr[2],bd_addr[3],
                      bd_addr[4],bd_addr[5]);
 
+    *p_div = 0;
     p_dev_rec = btm_find_dev (bd_addr);
 
     if (p_dev_rec && p_dev_rec->ble.keys.div)