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/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*/