hal: Fix compilation errors

- To fix compilation errors, remove unused
  variable in codebase
- Fix KW issues by adding mutex unlock

Change-Id: I392f4abf53e07524ca28c4559271b153f4190b34
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index fb35d14..a6ffb92 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -1107,7 +1107,7 @@
             break;
         }
 
-        ALOGD("%s: set afe dec channels =%d", __func__, channels);
+        ALOGD("%s: set afe dec channels =%s", __func__, channels);
         ctrl_channels = mixer_get_ctl_by_name(a2dp.adev->mixer,
                                             MIXER_AFE_SINK_CHANNELS);
     } else {
@@ -1122,7 +1122,7 @@
             break;
         }
 
-        ALOGD("%s: set afe enc channels =%d", __func__, channels);
+        ALOGD("%s: set afe enc channels =%s", __func__, channels);
         ctrl_channels = mixer_get_ctl_by_name(a2dp.adev->mixer,
                                             MIXER_AFE_IN_CHANNELS);
     }
@@ -1131,7 +1131,7 @@
         ALOGE(" ERROR AFE channels mixer control not identified");
     } else {
         if (mixer_ctl_set_enum_by_string(ctrl_channels, channels) != 0) {
-            ALOGE("%s: Failed to set AFE channels =%d", __func__, channels);
+            ALOGE("%s: Failed to set AFE channels =%s", __func__, channels);
             is_configured = false;
             goto fail;
         }
@@ -1406,7 +1406,6 @@
     codec_t codec_type = CODEC_TYPE_INVALID;
     bool is_configured = false;
     struct mixer_ctl *ctl_dec_data = NULL;
-    int ret = 0;
 
     if (!a2dp.audio_get_dec_config) {
         ALOGE(" a2dp handle is not identified, ignoring a2dp decoder config");
@@ -1520,7 +1519,7 @@
     }
 
     memset(aptx_dsp_cfg, 0x0, sizeof(struct aptx_ad_enc_cfg_t));
-    aptx_dsp_cfg->custom_cfg.enc_format = ENC_MEDIA_FMT_APTX_AD;
+    aptx_dsp_cfg->custom_cfg.enc_format = MEDIA_FMT_APTX_AD;
 
 
     aptx_dsp_cfg->aptx_ad_cfg.sampling_freq = aptx_bt_cfg->ad_cfg->sampling_rate;
@@ -2163,7 +2162,7 @@
               aptx_encoder_cfg.ad_cfg = (audio_aptx_ad_config *)codec_info;
               is_configured =
                 (configure_aptx_enc_format(&aptx_encoder_cfg) &&
-                 configure_a2dp_source_decoder_format(ENC_MEDIA_FMT_APTX_AD));
+                 configure_a2dp_source_decoder_format(MEDIA_FMT_APTX_AD));
             break;
 #endif
         default:
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 49145ec..75b74f2 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3482,7 +3482,6 @@
                                     int channel_count,
                                     bool is_low_latency)
 {
-    int i = 0;
     size_t size = 0;
     uint32_t bytes_per_period_sample = 0;
 
@@ -4703,6 +4702,7 @@
                 uint32_t bitwidth_dst = format_to_bitwidth_table[dst_format];
                 if ((bitwidth_src == 0) || (bitwidth_dst == 0)) {
                     ALOGE("%s: Error bitwidth == 0", __func__);
+                    pthread_mutex_unlock(&out->lock);
                     ATRACE_END();
                     return -EINVAL;
                 }
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 59fad85..07aff7a 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -7516,7 +7516,7 @@
     struct mixer_ctl *ctl;
     char mixer_ctl_name[44] = {0}; // max length of name is 44 as defined
     int ret;
-    unsigned int i=0, n=0;
+    int i=0, n=0;
     long set_values[AUDIO_MAX_DSP_CHANNELS];
     struct platform_data *my_data = (struct platform_data *)platform;
     struct audio_device *adev = my_data->adev;