hal: fix compiler warnings which are now treated as errors

With CLANG enabled and -Wall & -Werror being set in
LOCAL_CFLAGS, all warnings are treated as errors.

This commit fixes all the warnings most of which are
about unused variables and functions.

Change-Id: I32c6593fa0ad6a4fdca5dc8e6c76982a146a8bc6
diff --git a/hal/Android.mk b/hal/Android.mk
index 4c06288..c1e122d 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -285,7 +285,7 @@
     LOCAL_SHARED_LIBRARIES += libperipheral_client
 endif
 
-#LOCAL_CFLAGS += -Wall -Werror
+LOCAL_CFLAGS += -Wall -Werror
 
 LOCAL_COPY_HEADERS_TO   := mm-audio
 LOCAL_COPY_HEADERS      := audio_extn/audio_defs.h
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 54700ba..a28d52f 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -114,7 +114,7 @@
 
 static int32_t fm_stop(struct audio_device *adev)
 {
-    int32_t i, ret = 0;
+    int32_t ret = 0;
     struct audio_usecase *uc_info;
 
     ALOGD("%s: enter", __func__);
@@ -153,7 +153,7 @@
 
 static int32_t fm_start(struct audio_device *adev)
 {
-    int32_t i, ret = 0;
+    int32_t ret = 0;
     struct audio_usecase *uc_info;
     int32_t pcm_dev_rx_id, pcm_dev_tx_id;
 
diff --git a/hal/audio_extn/hfp.c b/hal/audio_extn/hfp.c
index 5a5afcc..1fba5c6 100644
--- a/hal/audio_extn/hfp.c
+++ b/hal/audio_extn/hfp.c
@@ -133,7 +133,7 @@
 static int32_t start_hfp(struct audio_device *adev,
                          struct str_parms *parms __unused)
 {
-    int32_t i, ret = 0;
+    int32_t ret = 0;
     struct audio_usecase *uc_info;
     int32_t pcm_dev_rx_id, pcm_dev_tx_id, pcm_dev_asm_rx_id, pcm_dev_asm_tx_id;
 
@@ -243,7 +243,7 @@
 
 static int32_t stop_hfp(struct audio_device *adev)
 {
-    int32_t i, ret = 0;
+    int32_t ret = 0;
     struct audio_usecase *uc_info;
 
     ALOGD("%s: enter", __func__);
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index 8882b90..7e37efc 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -170,7 +170,6 @@
 
 void audio_extn_sound_trigger_stop_lab(struct stream_in *in)
 {
-    int status = 0;
     struct sound_trigger_info  *st_ses_info = NULL;
     audio_event_info_t event;
 
@@ -341,7 +340,6 @@
 {
     int status = 0;
     char sound_trigger_lib[100];
-    void *lib_handle;
 
     ALOGI("%s: Enter", __func__);
 
diff --git a/hal/audio_extn/source_track.c b/hal/audio_extn/source_track.c
index 8bf4c67..bbe876b 100644
--- a/hal/audio_extn/source_track.c
+++ b/hal/audio_extn/source_track.c
@@ -255,9 +255,8 @@
 
 static int parse_soundfocus_sourcetracking_keys(struct str_parms *parms)
 {
-    char *str;
     char *value = NULL;
-    int val, len;
+    int len;
     int ret = 0, err;
     char *kv_pairs = str_parms_to_str(parms);
 
@@ -339,7 +338,7 @@
     char sound_focus_mixer_ctl_name[MIXER_PATH_MAX_LENGTH] = "Sound Focus";
     char source_tracking_mixer_ctl_name[MIXER_PATH_MAX_LENGTH] = "Source Tracking";
     int ret = -EINVAL;
-    int i, count;
+    int count;
 
     if (bitmask & BITMASK_AUDIO_PARAMETER_KEYS_SOUND_FOCUS) {
         /* Derive the mixer control name based on the use case and the audio interface
@@ -434,7 +433,7 @@
                                                 const struct sound_focus_param sound_focus_data,
                                                 const struct source_tracking_param source_tracking_data)
 {
-    int i = 0, len = 0;
+    int i = 0;
     char value[MAX_STR_SIZE] = "";
 
     if (bitmask & BITMASK_AUDIO_PARAMETER_KEY_SOUND_FOCUS_START_ANGLES) {
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 44ff952..1a616df 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -242,7 +242,6 @@
 
 static void spkr_prot_set_spkrstatus(bool enable)
 {
-    struct timespec ts;
     if (enable)
        handle.spkr_in_use = true;
     else {
@@ -255,7 +254,6 @@
 {
     pthread_t threadid;
     struct audio_usecase *uc_info;
-    int count = 0;
     threadid = pthread_self();
     ALOGV("%s: Entry", __func__);
     if (pthread_equal(handle.speaker_prot_threadid, threadid) || !adev) {
@@ -657,7 +655,6 @@
 {
     unsigned long sec = 0;
     int t0;
-    int i = 0;
     int t0_spk_1 = 0;
     int t0_spk_2 = 0;
     bool goahead = false;
@@ -1131,9 +1128,8 @@
 int audio_extn_fbsp_set_parameters(struct str_parms *parms)
 {
     int ret= 0 , err;
-    char *str;
     char *value = NULL;
-    int val, len, i;
+    int len;
     char *test_r = NULL;
     char *cfg_str;
     int wait_time, ftm_time;
@@ -1241,7 +1237,6 @@
         get_spkr_prot_ftm_param(value);
         str_parms_add_str(reply, AUDIO_PARAMETER_KEY_FBSP_GET_FTM_PARAM, value);
     }
-done:
     return err;
 }
 
diff --git a/hal/audio_extn/ssr.c b/hal/audio_extn/ssr.c
index cf393c5..6534385 100644
--- a/hal/audio_extn/ssr.c
+++ b/hal/audio_extn/ssr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
  * Not a Contribution.
  *
  * Copyright (C) 2013 The Android Open Source Project
@@ -155,10 +155,6 @@
 
 static void *ssr_process_thread(void *context);
 
-/* Use AAC/DTS channel mapping as default channel mapping: C,FL,FR,Ls,Rs,LFE */
-static const int chan_map[] = { 1, 2, 4, 3, 0, 5};
-
-
 static int32_t drc_init_lib(int num_chan, int sample_rate __unused)
 {
     int ret = 0;
@@ -424,7 +420,6 @@
 {
     uint32_t ret = -1;
     char c_multi_ch_dump[128] = {0};
-    char c_ssr_3mic[128] = {0};
     uint32_t buffer_size;
 
     ALOGD("%s: ssr case, sample rate %d", __func__, in->config.rate);
@@ -559,8 +554,6 @@
 
 int32_t audio_extn_ssr_deinit()
 {
-    int i;
-
     ALOGV("%s: entry", __func__);
     deinit_ssr_process_thread();
 
@@ -681,7 +674,6 @@
                        void *buffer, size_t bytes)
 {
     struct stream_in *in = (struct stream_in *)stream;
-    struct audio_device *adev = in->dev;
     int32_t ret = 0;
     struct pcm_buffer_queue *in_buf;
     struct pcm_buffer_queue *out_buf;
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 8f49b8d..846f88f 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -391,7 +391,6 @@
 void audio_extn_utils_dump_streams_output_cfg_list(
                                        struct listnode *streams_output_cfg_list)
 {
-    int i=0;
     struct listnode *node_i, *node_j;
     struct streams_output_cfg *so_info;
     struct stream_format *sf_info;
@@ -418,7 +417,6 @@
 {
     struct listnode *node_i, *node_j;
     struct streams_output_cfg *so_info;
-    struct stream_format *sf_info;
 
     ALOGV("%s", __func__);
     while (!list_empty(streams_output_cfg_list)) {
@@ -490,10 +488,9 @@
                                   audio_channel_mask_t channel_mask,
                                   struct stream_app_type_cfg *app_type_cfg)
 {
-    struct listnode *node_i, *node_j, *node_k;
+    struct listnode *node_i, *node_j;
     struct streams_output_cfg *so_info;
     struct stream_format *sf_info;
-    struct stream_sample_rate *ss_info;
     char value[PROPERTY_VALUE_MAX] = {0};
 
     if ((24 == bit_width) &&
@@ -567,7 +564,7 @@
     char mixer_ctl_name[MAX_LENGTH_MIXER_CONTROL_IN_INT];
     int app_type_cfg[MAX_LENGTH_MIXER_CONTROL_IN_INT], len = 0, rc;
     struct mixer_ctl *ctl;
-    int pcm_device_id, acdb_dev_id, snd_device = usecase->out_snd_device;
+    int pcm_device_id = 0, acdb_dev_id, snd_device = usecase->out_snd_device;
     int32_t sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
     char value[PROPERTY_VALUE_MAX] = {0};
 
@@ -855,7 +852,6 @@
         default:
             break;
     }
-done:
     outp[k] = '\0';
     return k;
 }
@@ -890,8 +886,6 @@
 void get_default_compressed_channel_status(
                                   unsigned char *channel_status)
 {
-     int32_t status = 0;
-     unsigned char bit_index;
      memset(channel_status,0,24);
 
      /* block start bit in preamble bit 3 */
@@ -937,7 +931,6 @@
                                                   unsigned char *channel_status)
 {
      int32_t status = 0;
-     unsigned char bit_index;
      memset(channel_status,0,24);
      /* block start bit in preamble bit 3 */
      channel_status[0] |= PROFESSIONAL;
@@ -989,7 +982,7 @@
     struct snd_aes_iec958 iec958;
     const char *mixer_ctl_name = "IEC958 Playback PCM Stream";
     struct mixer_ctl *ctl;
-    int i=0;
+    ALOGV("%s: buffer %s bytes %zd", __func__, buffer, bytes);
 #ifdef HDMI_PASSTHROUGH_ENABLED
     if (audio_extn_is_dolby_format(out->format) &&
         /*TODO:Extend code to support DTS passthrough*/
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
old mode 100755
new mode 100644
index d7a3169..4840bf1
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -249,8 +249,6 @@
 static pthread_mutex_t adev_init_lock;
 static unsigned int audio_device_ref_count;
 
-static int set_voice_volume_l(struct audio_device *adev, float volume);
-
 __attribute__ ((visibility ("default")))
 bool audio_hw_send_gain_dep_calibration(int level) {
     bool ret_val = false;
@@ -938,7 +936,6 @@
     struct audio_usecase *voip_usecase = NULL;
     struct audio_usecase *hfp_usecase = NULL;
     audio_usecase_t hfp_ucid;
-    struct listnode *node;
     int status = 0;
 
     ALOGD("%s for use case (%s)", __func__, use_case_table[uc_id]);
@@ -1130,7 +1127,7 @@
 
 static int stop_input_stream(struct stream_in *in)
 {
-    int i, ret = 0;
+    int ret = 0;
     struct audio_usecase *uc_info;
     struct audio_device *adev = in->dev;
 
@@ -1617,7 +1614,7 @@
 
 static int stop_output_stream(struct stream_out *out)
 {
-    int i, ret = 0;
+    int ret = 0;
     struct audio_usecase *uc_info;
     struct audio_device *adev = out->dev;
 
@@ -2048,12 +2045,9 @@
 {
     struct stream_out *out = (struct stream_out *)stream;
     struct audio_device *adev = out->dev;
-    struct audio_usecase *usecase;
-    struct listnode *node;
     struct str_parms *parms;
     char value[32];
     int ret = 0, val = 0, err;
-    bool select_new_device = false;
 
     ALOGD("%s: enter: usecase(%d: %s) kvpairs: %s",
           __func__, out->usecase, use_case_table[out->usecase], kvpairs);
@@ -2372,7 +2366,7 @@
         ret = compress_write(out->compr, buffer, bytes);
         if (ret < 0)
             ret = -errno;
-        ALOGVV("%s: writing buffer (%d bytes) to compress device returned %d", __func__, bytes, ret);
+        ALOGVV("%s: writing buffer (%zu bytes) to compress device returned %zd", __func__, bytes, ret);
         if (ret >= 0 && ret < (ssize_t)bytes) {
             ALOGD("No space available in compress driver, post msg to cb thread");
             send_offload_cmd_l(out, OFFLOAD_CMD_WAIT_FOR_BUFFER);
@@ -2400,7 +2394,7 @@
             if (out->muted)
                 memset((void *)buffer, 0, bytes);
 
-            ALOGVV("%s: writing buffer (%d bytes) to pcm device", __func__, bytes);
+            ALOGVV("%s: writing buffer (%zu bytes) to pcm device", __func__, bytes);
 
             if (adev->adm_request_focus)
                 adev->adm_request_focus(adev->adm_data, out->handle);
@@ -2761,7 +2755,6 @@
     struct stream_in *in = (struct stream_in *)stream;
     struct audio_device *adev = in->dev;
     struct str_parms *parms;
-    char *str;
     char value[32];
     int ret = 0, val = 0, err;
 
@@ -2805,7 +2798,6 @@
         }
     }
 
-done:
     pthread_mutex_unlock(&adev->lock);
     pthread_mutex_unlock(&in->lock);
 
@@ -2821,7 +2813,6 @@
     struct stream_in *in = (struct stream_in *)stream;
     struct str_parms *query = str_parms_create_str(keys);
     char *str;
-    char value[256];
     struct str_parms *reply = str_parms_create();
 
     if (!query || !reply) {
@@ -2858,7 +2849,7 @@
 {
     struct stream_in *in = (struct stream_in *)stream;
     struct audio_device *adev = in->dev;
-    int i, ret = -1;
+    int ret = -1;
     int snd_scard_state = get_snd_card_state(adev);
 
     lock_input_stream(in);
@@ -3005,7 +2996,7 @@
 {
     struct audio_device *adev = (struct audio_device *)dev;
     struct stream_out *out;
-    int i, ret = 0;
+    int ret = 0;
     audio_format_t format;
 
     *stream_out = NULL;
@@ -3226,7 +3217,7 @@
         //Decide if we need to use gapless mode by default
         check_and_set_gapless_mode(adev);
     } else if (out->flags & AUDIO_OUTPUT_FLAG_INCALL_MUSIC) {
-        ret = voice_check_and_set_incall_music_usecase(adev, out);
+        ret = voice_extn_check_and_set_incall_music_usecase(adev, out);
         if (ret != 0) {
             ALOGE("%s: Incall music delivery usecase cannot be set error:%d",
                   __func__, ret);
@@ -3416,7 +3407,6 @@
 {
     struct audio_device *adev = (struct audio_device *)dev;
     struct str_parms *parms;
-    char *str;
     char value[32];
     int val;
     int ret;
@@ -3431,8 +3421,6 @@
     if (ret >= 0) {
         char *snd_card_status = value+2;
         if (strstr(snd_card_status, "OFFLINE")) {
-            struct listnode *node;
-            struct audio_usecase *usecase;
             ALOGD("Received sound card OFFLINE status");
             set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
             //close compress sessions on OFFLINE status
@@ -3899,8 +3887,6 @@
 static int adev_open(const hw_module_t *module, const char *name,
                      hw_device_t **device)
 {
-    int i, ret;
-
     ALOGD("%s: enter", __func__);
     if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0) return -EINVAL;
 
diff --git a/hal/msm8916/hw_info.c b/hal/msm8916/hw_info.c
index fb8d648..e18f2ec 100644
--- a/hal/msm8916/hw_info.c
+++ b/hal/msm8916/hw_info.c
@@ -53,78 +53,6 @@
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 #define WSA_MIXER_PATH_EXTENSION "wsa-"
 
-static const snd_device_t taiko_fluid_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
-};
-
-static const snd_device_t taiko_CDP_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
-    SND_DEVICE_IN_QUAD_MIC,
-};
-
-static const snd_device_t taiko_apq8084_CDP_variant_devices[] = {
-    SND_DEVICE_IN_HANDSET_MIC,
-};
-
-static const snd_device_t taiko_liquid_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
-    SND_DEVICE_IN_SPEAKER_MIC,
-    SND_DEVICE_IN_HEADSET_MIC,
-    SND_DEVICE_IN_VOICE_DMIC,
-    SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
-    SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
-    SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
-    SND_DEVICE_IN_QUAD_MIC,
-    SND_DEVICE_IN_HANDSET_STEREO_DMIC,
-    SND_DEVICE_IN_SPEAKER_STEREO_DMIC,
-};
-
-static const snd_device_t taiko_DB_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
-    SND_DEVICE_IN_SPEAKER_MIC,
-    SND_DEVICE_IN_HEADSET_MIC,
-    SND_DEVICE_IN_QUAD_MIC,
-};
-
-static const snd_device_t tapan_lite_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_VOICE_HEADPHONES,
-    SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
-    SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
-};
-
-static const snd_device_t tapan_skuf_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
-    /*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/
-};
-
-static const snd_device_t tapan_lite_skuf_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_VOICE_HEADPHONES,
-    SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
-    SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
-};
-
-static const snd_device_t helicon_skuab_variant_devices[] = {
-    SND_DEVICE_OUT_SPEAKER,
-    SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
-    SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
-};
-
 static const snd_device_t wsa_combo_devices[] = {
     SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
     SND_DEVICE_OUT_SPEAKER_AND_LINE,
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 923135e..17e496d 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1076,7 +1076,7 @@
 }
 
 void platform_set_echo_reference(struct audio_device *adev, bool enable,
-    audio_devices_t out_device)
+                                 audio_devices_t out_device __unused)
 {
     struct platform_data *my_data = (struct platform_data *)adev->platform;
 
@@ -1121,140 +1121,6 @@
     }
 }
 
-static struct csd_data *open_csd_client()
-{
-    struct csd_data *csd = calloc(1, sizeof(struct csd_data));
-    if (!csd) {
-        ALOGE("failed to allocate csd_data mem");
-        return NULL;
-    }
-
-    csd->csd_client = dlopen(LIB_CSD_CLIENT, RTLD_NOW);
-    if (csd->csd_client == NULL) {
-        ALOGE("%s: DLOPEN failed for %s", __func__, LIB_CSD_CLIENT);
-        goto error;
-    } else {
-        ALOGV("%s: DLOPEN successful for %s", __func__, LIB_CSD_CLIENT);
-
-        csd->deinit = (deinit_t)dlsym(csd->csd_client,
-                                             "csd_client_deinit");
-        if (csd->deinit == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_deinit", __func__,
-                  dlerror());
-            goto error;
-        }
-        csd->disable_device = (disable_device_t)dlsym(csd->csd_client,
-                                             "csd_client_disable_device");
-        if (csd->disable_device == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_disable_device",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->enable_device_config = (enable_device_config_t)dlsym(csd->csd_client,
-                                               "csd_client_enable_device_config");
-        if (csd->enable_device_config == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_enable_device_config",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->enable_device = (enable_device_t)dlsym(csd->csd_client,
-                                             "csd_client_enable_device");
-        if (csd->enable_device == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_enable_device",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->start_voice = (start_voice_t)dlsym(csd->csd_client,
-                                             "csd_client_start_voice");
-        if (csd->start_voice == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_start_voice",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->stop_voice = (stop_voice_t)dlsym(csd->csd_client,
-                                             "csd_client_stop_voice");
-        if (csd->stop_voice == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_stop_voice",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->volume = (volume_t)dlsym(csd->csd_client,
-                                             "csd_client_volume");
-        if (csd->volume == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_volume",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->mic_mute = (mic_mute_t)dlsym(csd->csd_client,
-                                             "csd_client_mic_mute");
-        if (csd->mic_mute == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_mic_mute",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->slow_talk = (slow_talk_t)dlsym(csd->csd_client,
-                                             "csd_client_slow_talk");
-        if (csd->slow_talk == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_slow_talk",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->start_playback = (start_playback_t)dlsym(csd->csd_client,
-                                             "csd_client_start_playback");
-        if (csd->start_playback == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_start_playback",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->stop_playback = (stop_playback_t)dlsym(csd->csd_client,
-                                             "csd_client_stop_playback");
-        if (csd->stop_playback == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_stop_playback",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->set_lch = (set_lch_t)dlsym(csd->csd_client, "csd_client_set_lch");
-        if (csd->set_lch == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_set_lch",
-                  __func__, dlerror());
-            /* Ignore the error as this is not mandatory function for
-             * basic voice call to work.
-             */
-        }
-        csd->start_record = (start_record_t)dlsym(csd->csd_client,
-                                             "csd_client_start_record");
-        if (csd->start_record == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_start_record",
-                  __func__, dlerror());
-            goto error;
-        }
-        csd->stop_record = (stop_record_t)dlsym(csd->csd_client,
-                                             "csd_client_stop_record");
-        if (csd->stop_record == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_stop_record",
-                  __func__, dlerror());
-            goto error;
-        }
-
-
-        csd->init = (init_t)dlsym(csd->csd_client, "csd_client_init");
-
-        if (csd->init == NULL) {
-            ALOGE("%s: dlsym error %s for csd_client_init",
-                  __func__, dlerror());
-            goto error;
-        } else {
-            csd->init();
-        }
-    }
-    return csd;
-
-error:
-    free(csd);
-    csd = NULL;
-    return csd;
-}
-
 void close_csd_client(struct csd_data *csd)
 {
     if (csd != NULL) {
@@ -1269,7 +1135,6 @@
 static void set_platform_defaults()
 {
     int32_t dev, count = 0;
-    char dsp_decoder_property[PROPERTY_VALUE_MAX];
     const char *MEDIA_MIMETYPE_AUDIO_ALAC = "audio/alac";
     const char *MEDIA_MIMETYPE_AUDIO_APE = "audio/x-ape";
 
@@ -1636,14 +1501,11 @@
 
 void *platform_init(struct audio_device *adev)
 {
-    char platform[PROPERTY_VALUE_MAX];
-    char baseband[PROPERTY_VALUE_MAX];
     char value[PROPERTY_VALUE_MAX];
     struct platform_data *my_data = NULL;
-    int retry_num = 0, snd_card_num = 0, key = 0;
+    int retry_num = 0, snd_card_num = 0;
     const char *snd_card_name;
     char mixer_xml_path[MAX_MIXER_XML_PATH],ffspEnable[PROPERTY_VALUE_MAX];
-    char *cvd_version = NULL;
     const char *mixer_ctl_name = "Set HPX ActiveBe";
     struct mixer_ctl *ctl = NULL;
     int idx;
@@ -2213,7 +2075,8 @@
         return DEFAULT_APP_TYPE;
 }
 
-int platform_get_default_app_type_v2(void *platform, usecase_type_t  type)
+int platform_get_default_app_type_v2(void *platform __unused,
+                                     usecase_type_t type __unused)
 {
     if(type == PCM_CAPTURE)
         return DEFAULT_APP_TYPE_TX_PATH;
@@ -2413,7 +2276,6 @@
 {
     struct platform_data *my_data = (struct platform_data *)platform;
     int acdb_dev_id, acdb_dev_type;
-    struct audio_device *adev = my_data->adev;
     int snd_device = SND_DEVICE_OUT_SPEAKER;
 
     if (usecase->type == PCM_PLAYBACK)
@@ -2595,7 +2457,8 @@
     return ret;
 }
 
-int platform_get_sample_rate(void *platform, uint32_t *rate)
+int platform_get_sample_rate(void *platform __unused,
+                             uint32_t *rate __unused)
 {
     return 0;
 }
@@ -3297,7 +3160,6 @@
     int max_channels = 2;
     int i = 0, ret = 0;
     struct platform_data *my_data = (struct platform_data *)platform;
-    struct audio_device *adev = my_data->adev;
     edid_audio_info *info = NULL;
     ret = platform_get_edid_info(platform);
     info = (edid_audio_info *)my_data->edid_info;
@@ -3374,168 +3236,11 @@
     return ret;
 }
 
-static int update_external_device_status(struct platform_data *my_data,
-                                 char* event_name, bool status)
-{
-    int ret = 0;
-    struct audio_usecase *usecase;
-    struct listnode *node;
-
-    ALOGD("Recieved  external event switch %s", event_name);
-
-    if (!strcmp(event_name, EVENT_EXTERNAL_SPK_1))
-        my_data->external_spk_1 = status;
-    else if (!strcmp(event_name, EVENT_EXTERNAL_SPK_2))
-        my_data->external_spk_2 = status;
-    else if (!strcmp(event_name, EVENT_EXTERNAL_MIC))
-        my_data->external_mic = status;
-    else {
-        ALOGE("The audio event type is not found");
-        return -EINVAL;
-    }
-
-    list_for_each(node, &my_data->adev->usecase_list) {
-        usecase = node_to_item(node, struct audio_usecase, list);
-        select_devices(my_data->adev, usecase->id);
-    }
-
-    return ret;
-}
-
-static int parse_audiocal_cfg(struct str_parms *parms, acdb_audio_cal_cfg_t *cal)
-{
-    int err;
-    unsigned int val;
-    char value[64];
-    int ret = 0;
-
-    if(parms == NULL || cal == NULL)
-        return ret;
-
-    err = str_parms_get_str(parms, "cal_persist", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_persist");
-        cal->persist = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x1;
-    }
-    err = str_parms_get_str(parms, "cal_apptype", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_apptype");
-        cal->app_type = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x2;
-    }
-    err = str_parms_get_str(parms, "cal_caltype", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_caltype");
-        cal->cal_type = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x4;
-    }
-    err = str_parms_get_str(parms, "cal_samplerate", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_samplerate");
-        cal->sampling_rate = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x8;
-    }
-    err = str_parms_get_str(parms, "cal_devid", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_devid");
-        cal->dev_id = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x10;
-    }
-    err = str_parms_get_str(parms, "cal_snddevid", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_snddevid");
-        cal->snd_dev_id = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x20;
-    }
-    err = str_parms_get_str(parms, "cal_topoid", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_topoid");
-        cal->topo_id = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x40;
-    }
-    err = str_parms_get_str(parms, "cal_moduleid", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_moduleid");
-        cal->module_id = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x80;
-    }
-    err = str_parms_get_str(parms, "cal_paramid", value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(parms, "cal_paramid");
-        cal->param_id = (uint32_t) strtoul(value, NULL, 0);
-        ret = ret | 0x100;
-    }
-    return ret;
-}
-
-static void set_audiocal(void *platform, struct str_parms *parms, char *value, int len) {
-    struct platform_data *my_data = (struct platform_data *)platform;
-    struct stream_out out;
-    acdb_audio_cal_cfg_t cal={0};
-    uint8_t *dptr = NULL;
-    int32_t dlen;
-    int err, ret;
-    if(value == NULL || platform == NULL || parms == NULL) {
-        ALOGE("[%s] received null pointer, failed",__func__);
-        goto done_key_audcal;
-    }
-
-    /* parse audio calibration keys */
-    ret = parse_audiocal_cfg(parms, &cal);
-
-    /* handle audio calibration data now */
-    err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_AUD_CALDATA, value, len);
-    if (err >= 0) {
-        str_parms_del(parms, AUDIO_PARAMETER_KEY_AUD_CALDATA);
-        dlen = strlen(value);
-        if(dlen <= 0) {
-            ALOGE("[%s] null data received",__func__);
-            goto done_key_audcal;
-        }
-        dptr = (uint8_t*) calloc(dlen, sizeof(uint8_t));
-        if(dptr == NULL) {
-            ALOGE("[%s] memory allocation failed for %d",__func__, dlen);
-            goto done_key_audcal;
-        }
-        dlen = b64decode(value, strlen(value), dptr);
-        if(dlen<=0) {
-            ALOGE("[%s] data decoding failed %d", __func__, dlen);
-            goto done_key_audcal;
-        }
-
-        if(cal.dev_id) {
-          if(audio_is_input_device(cal.dev_id)) {
-              cal.snd_dev_id = platform_get_input_snd_device(platform, cal.dev_id);
-          } else {
-              out.devices = cal.dev_id;
-              out.sample_rate = cal.sampling_rate;
-              cal.snd_dev_id = platform_get_output_snd_device(platform, &out);
-          }
-        }
-        cal.acdb_dev_id = platform_get_snd_device_acdb_id(cal.snd_dev_id);
-        ALOGD("Setting audio calibration for snd_device(%d) acdb_id(%d)",
-                cal.snd_dev_id, cal.acdb_dev_id);
-        if(cal.acdb_dev_id == -EINVAL) {
-            ALOGE("[%s] Invalid acdb_device id %d for snd device id %d",
-                       __func__, cal.acdb_dev_id, cal.snd_dev_id);
-            goto done_key_audcal;
-        }
-        if(my_data->acdb_set_audio_cal) {
-            ret = my_data->acdb_set_audio_cal((void *)&cal, (void*)dptr, dlen);
-        }
-    }
-done_key_audcal:
-    if(dptr != NULL)
-        free(dptr);
-}
-
 int platform_set_parameters(void *platform, struct str_parms *parms)
 {
     struct platform_data *my_data = (struct platform_data *)platform;
-    char *str;
     char value[256] = {0};
-    int val,len;
+    int len;
     int ret = 0, err;
     char *kv_pairs = NULL;
 
@@ -3710,108 +3415,11 @@
     return ret;
 }
 
-static void get_audiocal(void *platform, void *keys, void *pReply) {
-    struct platform_data *my_data = (struct platform_data *)platform;
-    struct stream_out out;
-    struct str_parms *query = (struct str_parms *)keys;
-    struct str_parms *reply=(struct str_parms *)pReply;
-    acdb_audio_cal_cfg_t cal={0};
-    uint8_t *dptr = NULL;
-    char value[512] = {0};
-    char *rparms=NULL;
-    int ret=0, err;
-    uint32_t param_len;
-
-    if(query==NULL || platform==NULL || reply==NULL) {
-        ALOGE("[%s] received null pointer",__func__);
-        ret=-EINVAL;
-        goto done;
-    }
-    /* parse audiocal configuration keys */
-    ret = parse_audiocal_cfg(query, &cal);
-    if(ret == 0) {
-        /* No calibration keys found */
-        goto done;
-    }
-    err = str_parms_get_str(query, AUDIO_PARAMETER_KEY_AUD_CALDATA, value, sizeof(value));
-    if (err >= 0) {
-        str_parms_del(query, AUDIO_PARAMETER_KEY_AUD_CALDATA);
-    } else {
-        goto done;
-    }
-
-    if(cal.dev_id & AUDIO_DEVICE_BIT_IN) {
-        cal.snd_dev_id = platform_get_input_snd_device(platform, cal.dev_id);
-    } else if(cal.dev_id) {
-        out.devices = cal.dev_id;
-        out.sample_rate = cal.sampling_rate;
-        cal.snd_dev_id = platform_get_output_snd_device(platform, &out);
-    }
-    cal.acdb_dev_id =  platform_get_snd_device_acdb_id(cal.snd_dev_id);
-    if (cal.acdb_dev_id < 0) {
-        ALOGE("%s: Failed. Could not find acdb id for snd device(%d)",
-              __func__, cal.snd_dev_id);
-        ret = -EINVAL;
-        goto done_key_audcal;
-    }
-    ALOGD("[%s] Getting audio calibration for snd_device(%d) acdb_id(%d)",
-           __func__, cal.snd_dev_id, cal.acdb_dev_id);
-
-    param_len = MAX_SET_CAL_BYTE_SIZE;
-    dptr = (uint8_t*)calloc(param_len, sizeof(uint8_t));
-    if(dptr == NULL) {
-        ALOGE("[%s] Memory allocation failed for length %d",__func__,param_len);
-        ret = -ENOMEM;
-        goto done_key_audcal;
-    }
-    if (my_data->acdb_get_audio_cal != NULL) {
-        ret = my_data->acdb_get_audio_cal((void*)&cal, (void*)dptr, &param_len);
-        if (ret == 0) {
-            int dlen;
-            if(param_len == 0 || param_len == MAX_SET_CAL_BYTE_SIZE) {
-                ret = -EINVAL;
-                goto done_key_audcal;
-            }
-            /* Allocate memory for encoding */
-            rparms = (char*)calloc((param_len*2), sizeof(char));
-            if(rparms == NULL) {
-                ALOGE("[%s] Memory allocation failed for size %d",
-                            __func__, param_len*2);
-                ret = -ENOMEM;
-                goto done_key_audcal;
-            }
-            if(cal.persist==0 && cal.module_id && cal.param_id) {
-                err = b64encode(dptr+12, param_len-12, rparms);
-            } else {
-                err = b64encode(dptr, param_len, rparms);
-            }
-            if(err < 0) {
-                ALOGE("[%s] failed to convert data to string", __func__);
-                ret = -EINVAL;
-                goto done_key_audcal;
-            }
-            str_parms_add_int(reply, AUDIO_PARAMETER_KEY_AUD_CALRESULT, ret);
-            str_parms_add_str(reply, AUDIO_PARAMETER_KEY_AUD_CALDATA, rparms);
-        }
-    }
-done_key_audcal:
-    if(ret != 0) {
-        str_parms_add_int(reply, AUDIO_PARAMETER_KEY_AUD_CALRESULT, ret);
-        str_parms_add_str(reply, AUDIO_PARAMETER_KEY_AUD_CALDATA, "");
-    }
-done:
-    if(dptr != NULL)
-        free(dptr);
-    if(rparms != NULL)
-        free(rparms);
-}
-
 void platform_get_parameters(void *platform,
                             struct str_parms *query,
                             struct str_parms *reply)
 {
     struct platform_data *my_data = (struct platform_data *)platform;
-    char *str = NULL;
     char value[512] = {0};
     int ret;
     char *kv_pairs = NULL;
@@ -4119,9 +3727,6 @@
     int ret = 0;
     int backend_idx = DEFAULT_CODEC_BACKEND;
     struct platform_data *my_data = (struct platform_data *)adev->platform;
-    const char *snd_card_name = mixer_get_name(adev->mixer);
-    int na_mode = platform_get_native_support();
-
 
     backend_idx = platform_get_backend_index(snd_device);
     ALOGI("%s:becf: afe: bitwidth %d, samplerate %d, backend_idx %d device (%s)",
@@ -4383,7 +3988,6 @@
     unsigned int new_bit_width;
     unsigned int new_sample_rate;
     int backend_idx = DEFAULT_CODEC_BACKEND;
-    struct platform_data *my_data = (struct platform_data *)adev->platform;
 
     backend_idx = platform_get_backend_index(snd_device);
 
@@ -4544,10 +4148,7 @@
     struct platform_data *my_data = (struct platform_data *)platform;
     struct audio_device *adev = my_data->adev;
     char block[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE];
-    char *sad = block;
-    int num_audio_blocks;
-    int channel_count = 2;
-    int i, ret, count;
+    int ret, count;
 
     struct mixer_ctl *ctl;
     char edid_data[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE + 1] = {0};
@@ -4635,7 +4236,6 @@
     int ret;
     unsigned int i;
     int set_values[8] = {0};
-    char device_num[13]; // device number up to 2 digit
     struct platform_data *my_data = (struct platform_data *)platform;
     struct audio_device *adev = my_data->adev;
     ALOGV("%s channel_count:%d",__func__, ch_count);
@@ -4733,10 +4333,8 @@
 bool platform_is_edid_supported_format(void *platform, int format)
 {
     struct platform_data *my_data = (struct platform_data *)platform;
-    struct audio_device *adev = my_data->adev;
     edid_audio_info *info = NULL;
-    int num_audio_blocks;
-    int i, ret, count;
+    int i, ret;
     unsigned char format_id = platform_map_to_edid_format(format);
 
     ret = platform_get_edid_info(platform);
@@ -4763,11 +4361,9 @@
 int platform_set_edid_channels_configuration(void *platform, int channels) {
 
     struct platform_data *my_data = (struct platform_data *)platform;
-    struct audio_device *adev = my_data->adev;
     edid_audio_info *info = NULL;
-    int num_audio_blocks;
     int channel_count = 2;
-    int i, ret, count;
+    int i, ret;
     char default_channelMap[MAX_CHANNELS_SUPPORTED] = {0};
 
     ret = platform_get_edid_info(platform);
@@ -5046,7 +4642,6 @@
                                       const char *spkr_1_tz_name, const char *spkr_2_tz_name)
 {
     int ret = 0;
-    int i;
 
     if (spkr_1_tz_name == NULL && spkr_2_tz_name == NULL) {
         ALOGE("%s: Invalid input", __func__);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index c8edd3e..785a202 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -828,7 +828,7 @@
 }
 
 void platform_set_echo_reference(struct audio_device *adev, bool enable,
-                                 audio_devices_t out_device)
+                                 audio_devices_t out_device __unused)
 {
     struct platform_data *my_data = (struct platform_data *)adev->platform;
 
@@ -1029,8 +1029,8 @@
 
 static void set_platform_defaults()
 {
-    int32_t dev, count = 0;
-    char dsp_decoder_property[PROPERTY_VALUE_MAX];
+    int32_t dev;
+    unsigned int count = 0;
     const char *MEDIA_MIMETYPE_AUDIO_ALAC = "audio/alac";
     const char *MEDIA_MIMETYPE_AUDIO_APE = "audio/x-ape";
 
@@ -1299,9 +1299,8 @@
     char baseband[PROPERTY_VALUE_MAX];
     char value[PROPERTY_VALUE_MAX];
     struct platform_data *my_data = NULL;
-    int retry_num = 0, snd_card_num = 0, key = 0;
+    int retry_num = 0, snd_card_num = 0;
     char *snd_card_name = NULL, *snd_card_name_t = NULL;
-    char *cvd_version = NULL;
     char *snd_internal_name = NULL;
     char *tmp = NULL;
     char mixer_xml_file[MIXER_PATH_MAX_LENGTH]= {0};
@@ -2092,7 +2091,6 @@
 {
     struct platform_data *my_data = (struct platform_data *)platform;
     int acdb_dev_id, acdb_dev_type;
-    struct audio_device *adev = my_data->adev;
     int snd_device = SND_DEVICE_OUT_SPEAKER;
 
     if (usecase->type == PCM_PLAYBACK)
@@ -2920,7 +2918,6 @@
     int max_channels = 2;
     int i = 0, ret = 0;
     struct platform_data *my_data = (struct platform_data *)platform;
-    struct audio_device *adev = my_data->adev;
     edid_audio_info *info = NULL;
     ret = platform_get_edid_info(platform);
     info = (edid_audio_info *)my_data->edid_info;
@@ -3027,7 +3024,6 @@
 static int parse_audiocal_cfg(struct str_parms *parms, acdb_audio_cal_cfg_t *cal)
 {
     int err;
-    unsigned int val;
     char value[64];
     int ret = 0;
 
@@ -3094,7 +3090,7 @@
 static void set_audiocal(void *platform, struct str_parms *parms, char *value, int len) {
     struct platform_data *my_data = (struct platform_data *)platform;
     struct stream_out out;
-    acdb_audio_cal_cfg_t cal={0};
+    acdb_audio_cal_cfg_t cal;
     uint8_t *dptr = NULL;
     int32_t dlen;
     int err, ret;
@@ -3193,9 +3189,8 @@
 int platform_set_parameters(void *platform, struct str_parms *parms)
 {
     struct platform_data *my_data = (struct platform_data *)platform;
-    char *str;
     char *value=NULL;
-    int val, len;
+    int len;
     int ret = 0, err;
     char *kv_pairs = str_parms_to_str(parms);
 
@@ -3403,7 +3398,7 @@
     struct stream_out out;
     struct str_parms *query = (struct str_parms *)keys;
     struct str_parms *reply=(struct str_parms *)pReply;
-    acdb_audio_cal_cfg_t cal={0};
+    acdb_audio_cal_cfg_t cal;
     uint8_t *dptr = NULL;
     char value[512] = {0};
     char *rparms=NULL;
@@ -3455,7 +3450,6 @@
     if (my_data->acdb_get_audio_cal != NULL) {
         ret = my_data->acdb_get_audio_cal((void*)&cal, (void*)dptr, &param_len);
         if (ret == 0) {
-            int dlen;
             if(param_len == 0 || param_len == MAX_SET_CAL_BYTE_SIZE) {
                 ret = -EINVAL;
                 goto done_key_audcal;
@@ -3499,7 +3493,6 @@
                             struct str_parms *reply)
 {
     struct platform_data *my_data = (struct platform_data *)platform;
-    char *str = NULL;
     char value[512] = {0};
     int ret;
     char *kv_pairs = NULL;
@@ -3566,7 +3559,6 @@
         str_parms_add_int(reply, AUDIO_PARAMETER_IS_HW_DECODER_SESSION_ALLOWED, isallowed);
     }
 
-done:
     kv_pairs = str_parms_to_str(reply);
     ALOGV_IF(kv_pairs != NULL, "%s: exit: returns - %s", __func__, kv_pairs);
     free(kv_pairs);
@@ -3818,7 +3810,6 @@
 {
     bool backend_change = false;
     struct listnode *node;
-    struct stream_out *out = NULL;
     unsigned int bit_width;
     unsigned int sample_rate;
     int backend_idx = DEFAULT_CODEC_BACKEND;
@@ -3946,7 +3937,6 @@
     unsigned int new_bit_width;
     unsigned int new_sample_rate;
     int backend_idx = DEFAULT_CODEC_BACKEND;
-    struct platform_data *my_data = (struct platform_data *)adev->platform;
 
     backend_idx = platform_get_backend_index(snd_device);
 
@@ -4108,10 +4098,7 @@
     struct platform_data *my_data = (struct platform_data *)platform;
     struct audio_device *adev = my_data->adev;
     char block[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE];
-    char *sad = block;
-    int num_audio_blocks;
-    int channel_count = 2;
-    int i, ret, count;
+    int ret, count;
 
     struct mixer_ctl *ctl;
     char edid_data[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE + 1] = {0};
@@ -4200,7 +4187,6 @@
     int ret;
     unsigned int i;
     int set_values[8] = {0};
-    char device_num[13]; // device number up to 2 digit
     struct platform_data *my_data = (struct platform_data *)platform;
     struct audio_device *adev = my_data->adev;
     ALOGV("%s channel_count:%d",__func__, ch_count);
@@ -4298,10 +4284,8 @@
 bool platform_is_edid_supported_format(void *platform, int format)
 {
     struct platform_data *my_data = (struct platform_data *)platform;
-    struct audio_device *adev = my_data->adev;
     edid_audio_info *info = NULL;
-    int num_audio_blocks;
-    int i, ret, count;
+    int i, ret;
     unsigned char format_id = platform_map_to_edid_format(format);
 
     ret = platform_get_edid_info(platform);
@@ -4328,11 +4312,9 @@
 int platform_set_edid_channels_configuration(void *platform, int channels) {
 
     struct platform_data *my_data = (struct platform_data *)platform;
-    struct audio_device *adev = my_data->adev;
     edid_audio_info *info = NULL;
-    int num_audio_blocks;
     int channel_count = 2;
-    int i, ret, count;
+    int i, ret;
     char default_channelMap[MAX_CHANNELS_SUPPORTED] = {0};
 
     ret = platform_get_edid_info(platform);
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 92cc930..2be66c4 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -306,7 +306,7 @@
 }
 static void process_tz_name(const XML_Char **attr)
 {
-    int ret, index;
+    int index;
 
     if (strcmp(attr[0], "name") != 0) {
         ALOGE("%s: 'name' not found, no Audio Interface set!", __func__);
@@ -361,10 +361,6 @@
 static void start_tag(void *userdata __unused, const XML_Char *tag_name,
                       const XML_Char **attr)
 {
-    const XML_Char              *attr_name = NULL;
-    const XML_Char              *attr_value = NULL;
-    unsigned int                i;
-
     if (strcmp(tag_name, "bit_width_configs") == 0) {
         section = BITWIDTH;
     } else if (strcmp(tag_name, "acdb_ids") == 0) {
diff --git a/hal/voice.c b/hal/voice.c
index d1db987..bff69a1 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -111,7 +111,7 @@
 
 int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
 {
-    int i, ret = 0;
+    int ret = 0;
     struct audio_usecase *uc_info;
     struct voice_session *session = NULL;
 
@@ -164,7 +164,7 @@
 
 int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
 {
-    int i, ret = 0;
+    int ret = 0;
     struct audio_usecase *uc_info;
     int pcm_dev_rx_id, pcm_dev_tx_id;
     uint32_t sample_rate = 8000;
@@ -316,7 +316,6 @@
 {
     int ret = 0;
     uint32_t session_id;
-    int usecase_id;
     int rec_mode = INCALL_REC_NONE;
 
     if (voice_is_call_state_active(adev)) {
@@ -424,20 +423,6 @@
     return incall_record_device;
 }
 
-int voice_check_and_set_incall_music_usecase(struct audio_device *adev,
-                                             struct stream_out *out)
-{
-    int ret = 0;
-
-    ret = voice_extn_check_and_set_incall_music_usecase(adev, out);
-    if (ret == -ENOSYS) {
-        /* Incall music delivery is used only for LCH call state */
-        ret = -EINVAL;
-    }
-
-    return ret;
-}
-
 int voice_set_mic_mute(struct audio_device *adev, bool state)
 {
     int err = 0;
@@ -519,9 +504,7 @@
 
 int voice_set_parameters(struct audio_device *adev, struct str_parms *parms)
 {
-    char *str;
     char value[32];
-    int val;
     int ret = 0, err;
     char *kv_pairs = str_parms_to_str(parms);
 
diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c
index 7404617..7293485 100644
--- a/hal/voice_extn/compress_voip.c
+++ b/hal/voice_extn/compress_voip.c
@@ -242,7 +242,7 @@
 
 static int voip_stop_call(struct audio_device *adev)
 {
-    int i, ret = 0;
+    int ret = 0;
     struct audio_usecase *uc_info;
 
     ALOGD("%s: enter, out_stream_count=%d, in_stream_count=%d",
@@ -288,7 +288,7 @@
 static int voip_start_call(struct audio_device *adev,
                            struct pcm_config *voip_config)
 {
-    int i, ret = 0;
+    int ret = 0;
     struct audio_usecase *uc_info;
     int pcm_dev_rx_id, pcm_dev_tx_id;
     unsigned int flags = PCM_OUT | PCM_MONOTONIC;
@@ -384,10 +384,8 @@
 int voice_extn_compress_voip_set_parameters(struct audio_device *adev,
                                              struct str_parms *parms)
 {
-    char *str;
     char value[32]={0};
     int ret = 0, err, rate;
-    int min_rate, max_rate;
     bool flag;
     char *kv_pairs = str_parms_to_str(parms);
 
@@ -410,7 +408,6 @@
         voip_set_dtx(adev, flag);
     }
 
-done:
     ALOGV("%s: exit", __func__);
     free(kv_pairs);
     return ret;
@@ -421,7 +418,6 @@
 {
     int ret;
     char value[32]={0};
-    char *str = NULL;
 
     ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_VOIP_OUT_STREAM_COUNT,
                             value, sizeof(value));
@@ -442,7 +438,7 @@
                                                  struct str_parms *query,
                                                  struct str_parms *reply)
 {
-    int ret, val;
+    int ret;
     char value[32]={0};
 
     ALOGD("%s: enter", __func__);
@@ -463,7 +459,7 @@
                                                 struct str_parms *query,
                                                 struct str_parms *reply)
 {
-    int ret, val;
+    int ret;
     char value[32]={0};
     char *kv_pairs = NULL;
 
@@ -546,7 +542,6 @@
 int voice_extn_compress_voip_start_input_stream(struct stream_in *in)
 {
     int ret = 0;
-    struct audio_usecase *uc_info;
     struct audio_device *adev = in->dev;
     int snd_card_status = get_snd_card_state(adev);
 
@@ -590,7 +585,7 @@
 
 int voice_extn_compress_voip_open_output_stream(struct stream_out *out)
 {
-    int mode, ret;
+    int ret;
 
     ALOGD("%s: enter", __func__);
 
@@ -636,9 +631,7 @@
 
 int voice_extn_compress_voip_open_input_stream(struct stream_in *in)
 {
-    int sample_rate;
-    int buffer_size,frame_size;
-    int mode, ret;
+    int ret;
 
     ALOGD("%s: enter", __func__);
 
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index f36a7a6..3cd3e78 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
  * Not a contribution.
  *
  * Copyright (C) 2013 The Android Open Source Project
@@ -164,7 +164,6 @@
     audio_usecase_t usecase_id = 0;
     enum voice_lch_mode lch_mode;
     struct voice_session *session = NULL;
-    int fd = 0;
     int ret = 0;
 
     ALOGD("%s: enter:", __func__);
@@ -442,7 +441,6 @@
 int voice_extn_set_parameters(struct audio_device *adev,
                               struct str_parms *parms)
 {
-    char *str;
     int value;
     int ret = 0, err;
     char *kv_pairs = str_parms_to_str(parms);
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index 989ee79..dcce0ab 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -105,11 +105,7 @@
 int voice_extn_check_and_set_incall_music_usecase(struct audio_device *adev,
                                                   struct stream_out *out);
 #else
-static int voice_extn_check_and_set_incall_music_usecase(struct audio_device *adev __unused,
-                                                         struct stream_out *out __unused)
-{
-    return -ENOSYS;
-}
+#define voice_extn_check_and_set_incall_music_usecase(adev, out) -ENOSYS
 #endif
 
 #ifdef COMPRESS_VOIP_ENABLED