summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexy Joseph <alexyj@codeaurora.org>2016-01-29 15:49:38 -0800
committerSteve Kondik <steve@cyngn.com>2016-04-29 15:40:11 -0700
commit211004f06e472cefcbcd2e3e31bfff2d3eb332da (patch)
treeefae0479e21a134acc7068f09ff6e4f203d123dd
parenta5ccf0669ecba29c1840cfb3cd62de19f18d4b9c (diff)
downloadhardware_qcom_audio-211004f06e472cefcbcd2e3e31bfff2d3eb332da.tar.gz
hardware_qcom_audio-211004f06e472cefcbcd2e3e31bfff2d3eb332da.tar.bz2
hardware_qcom_audio-211004f06e472cefcbcd2e3e31bfff2d3eb332da.zip
hal: Fix warnings in audio HAL and policy
Enable Wall and Werror and fix warnings in HAL and policy manager Change-Id: Ie93c8f933943875ac68e8318d777602ed864f531
-rw-r--r--hal/Android.mk2
-rw-r--r--hal/audio_extn/audio_extn.c7
-rw-r--r--hal/audio_extn/dolby.c10
-rw-r--r--hal/audio_hw.c7
-rw-r--r--hal/audio_hw.h4
-rw-r--r--hal/msm8974/platform.c20
-rw-r--r--hal/voice.c6
-rw-r--r--hal/voice.h6
-rw-r--r--hal/voice_extn/compress_voip.c4
-rw-r--r--hal/voice_extn/voice_extn.h4
-rw-r--r--policy_hal/Android.mk2
11 files changed, 44 insertions, 28 deletions
diff --git a/hal/Android.mk b/hal/Android.mk
index 191a60d5..25962fb2 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -255,6 +255,8 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUXPCM_BT)),true)
LOCAL_CFLAGS += -DAUXPCM_BT_ENABLED
endif
+LOCAL_CFLAGS += -Wall -Werror
+
LOCAL_COPY_HEADERS_TO := mm-audio
LOCAL_COPY_HEADERS := audio_extn/audio_defs.h
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index ecf04818..a6085895 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -917,8 +917,11 @@ void audio_extn_perf_lock_acquire(int *handle, int duration,
int *perf_lock_opts, int size)
{
- if (!perf_lock_opts || !size || !perf_lock_acq || !handle)
- return -EINVAL;
+ if (!perf_lock_opts || !size || !perf_lock_acq || !handle) {
+ ALOGE("%s: Incorrect params, Failed to acquire perf lock, err ",
+ __func__);
+ return;
+ }
/*
* Acquire performance lock for 1 sec during device path bringup.
* Lock will be released either after 1 sec or when perf_lock_release
diff --git a/hal/audio_extn/dolby.c b/hal/audio_extn/dolby.c
index cdfa2a1e..ee6cee74 100644
--- a/hal/audio_extn/dolby.c
+++ b/hal/audio_extn/dolby.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2010 The Android Open Source Project
@@ -654,7 +654,8 @@ int audio_extn_dap_hal_init(int snd_card) {
ds2extnmod.dap_hal_set_hw_info(SND_CARD, (void*)(&snd_card));
ALOGV("%s Sound card number is:%d",__func__,snd_card);
- platform_get_device_to_be_id_map(&device_be_id_map.device_id_to_be_id, &device_be_id_map.len);
+ platform_get_device_to_be_id_map((int**)&device_be_id_map.device_id_to_be_id,
+ &device_be_id_map.len);
ds2extnmod.dap_hal_set_hw_info(DEVICE_BE_ID_MAP, (void*)(&device_be_id_map));
ALOGV("%s Set be id map len:%d",__func__,device_be_id_map.len);
ret = 0;
@@ -770,10 +771,9 @@ void audio_extn_dolby_set_license(struct audio_device *adev)
if (ds2extnmod.dap_hal_set_hw_info) {
ds2extnmod.dap_hal_set_hw_info(DMID, (void*)(&dolby_license.dmid));
} else {
- ALOGV("%s: dap_hal_set_hw_info is NULL", __func__);
- return ret;
+ ALOGE("%s: dap_hal_set_hw_info is NULL", __func__);
}
- return 0;
+ return;
}
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 22397bec..3bd4a1f6 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -896,7 +896,7 @@ static int read_hdmi_channel_masks(struct stream_out *out)
return ret;
}
-static audio_usecase_t get_voice_usecase_id_from_list(struct audio_device *adev)
+static audio_usecase_t get_voice_usecase_id_from_list(const struct audio_device *adev)
{
struct audio_usecase *usecase;
struct listnode *node;
@@ -911,7 +911,7 @@ static audio_usecase_t get_voice_usecase_id_from_list(struct audio_device *adev)
return USECASE_INVALID;
}
-struct audio_usecase *get_usecase_from_list(struct audio_device *adev,
+struct audio_usecase *get_usecase_from_list(const struct audio_device *adev,
audio_usecase_t uc_id)
{
struct audio_usecase *usecase;
@@ -2403,7 +2403,7 @@ exit:
if (ret != 0) {
if (out->pcm)
- ALOGE("%s: error %ld - %s", __func__, ret, pcm_get_error(out->pcm));
+ ALOGE("%s: error %d, %s", __func__, (int)ret, pcm_get_error(out->pcm));
if (out->usecase == USECASE_COMPRESS_VOIP_CALL) {
pthread_mutex_lock(&adev->lock);
voice_extn_compress_voip_close_output_stream(&out->stream.common);
@@ -3104,6 +3104,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->stream.drain = out_drain;
out->stream.flush = out_flush;
}
+
if (config->offload_info.channel_mask)
out->channel_mask = config->offload_info.channel_mask;
else if (config->channel_mask) {
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 7bd179de..ff0553ff 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -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
@@ -371,7 +371,7 @@ int enable_snd_device(struct audio_device *adev,
int enable_audio_route(struct audio_device *adev,
struct audio_usecase *usecase);
-struct audio_usecase *get_usecase_from_list(struct audio_device *adev,
+struct audio_usecase *get_usecase_from_list(const struct audio_device *adev,
audio_usecase_t uc_id);
bool is_offload_usecase(audio_usecase_t uc_id);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 4d040fa6..4cc371cb 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.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
@@ -1012,7 +1012,7 @@ void *platform_init(struct audio_device *adev)
char value[PROPERTY_VALUE_MAX];
struct platform_data *my_data = NULL;
int retry_num = 0, snd_card_num = 0, key = 0;
- const char *snd_card_name;
+ char *snd_card_name = NULL;
char *cvd_version = NULL;
my_data = calloc(1, sizeof(struct platform_data));
@@ -1039,7 +1039,7 @@ void *platform_init(struct audio_device *adev)
continue;
}
- snd_card_name = mixer_get_name(adev->mixer);
+ snd_card_name = strdup(mixer_get_name(adev->mixer));
ALOGV("%s: snd_card_name: %s", __func__, snd_card_name);
my_data->hw_info = hw_info_init(snd_card_name);
@@ -1059,7 +1059,11 @@ void *platform_init(struct audio_device *adev)
if (!adev->audio_route) {
ALOGE("%s: Failed to init audio route controls, aborting.",
__func__);
- free(my_data);
+ if (my_data)
+ free(my_data);
+ if (snd_card_name)
+ free(snd_card_name);
+ mixer_close(adev->mixer);
return NULL;
}
adev->snd_card = snd_card_num;
@@ -1072,7 +1076,11 @@ void *platform_init(struct audio_device *adev)
if (snd_card_num >= MAX_SND_CARD) {
ALOGE("%s: Unable to find correct sound card, aborting.", __func__);
- free(my_data);
+ if (my_data)
+ free(my_data);
+ if (snd_card_name)
+ free(snd_card_name);
+ mixer_close(adev->mixer);
return NULL;
}
@@ -3260,7 +3268,7 @@ done:
void platform_get_device_to_be_id_map(int **device_to_be_id, int *length)
{
- *device_to_be_id = msm_device_to_be_id;
+ *device_to_be_id = (int*) msm_device_to_be_id;
*length = msm_be_id_array_len;
}
diff --git a/hal/voice.c b/hal/voice.c
index edd8cae5..e12d24f3 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, 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
@@ -276,12 +276,12 @@ bool voice_is_call_state_active(struct audio_device *adev)
return call_state;
}
-bool voice_is_in_call(struct audio_device *adev)
+bool voice_is_in_call(const struct audio_device *adev)
{
return adev->voice.in_call;
}
-bool voice_is_in_call_rec_stream(struct stream_in *in)
+bool voice_is_in_call_rec_stream(const struct stream_in *in)
{
bool in_call_rec = false;
diff --git a/hal/voice.h b/hal/voice.h
index 0cf7bd27..ec5418af 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, 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
@@ -82,8 +82,8 @@ int voice_set_parameters(struct audio_device *adev, struct str_parms *parms);
void voice_get_parameters(struct audio_device *adev, struct str_parms *query,
struct str_parms *reply);
void voice_init(struct audio_device *adev);
-bool voice_is_in_call(struct audio_device *adev);
-bool voice_is_in_call_rec_stream(struct stream_in *in);
+bool voice_is_in_call(const struct audio_device *adev);
+bool voice_is_in_call_rec_stream(const struct stream_in *in);
int voice_set_mic_mute(struct audio_device *dev, bool state);
bool voice_get_mic_mute(struct audio_device *dev);
int voice_set_volume(struct audio_device *adev, float volume);
diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c
index a93ebf17..2acb4373 100644
--- a/hal/voice_extn/compress_voip.c
+++ b/hal/voice_extn/compress_voip.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
@@ -689,7 +689,7 @@ bool voice_extn_compress_voip_pcm_prop_check()
return false;
}
-bool voice_extn_compress_voip_is_active(struct audio_device *adev)
+bool voice_extn_compress_voip_is_active(const struct audio_device *adev)
{
struct audio_usecase *voip_usecase = NULL;
voip_usecase = get_usecase_from_list(adev, USECASE_COMPRESS_VOIP_CALL);
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index af0ad08b..989ee798 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -142,7 +142,7 @@ void voice_extn_compress_voip_in_get_parameters(struct stream_in *in,
struct str_parms *query,
struct str_parms *reply);
bool voice_extn_compress_voip_pcm_prop_check();
-bool voice_extn_compress_voip_is_active(struct audio_device *adev);
+bool voice_extn_compress_voip_is_active(const struct audio_device *adev);
bool voice_extn_compress_voip_is_format_supported(audio_format_t format);
bool voice_extn_compress_voip_is_config_supported(struct audio_config *config);
bool voice_extn_compress_voip_is_started(struct audio_device *adev);
diff --git a/policy_hal/Android.mk b/policy_hal/Android.mk
index 4c494717..7fb88eb9 100644
--- a/policy_hal/Android.mk
+++ b/policy_hal/Android.mk
@@ -27,6 +27,8 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_STATIC_LIBRARIES := \
libmedia_helper \
+LOCAL_CFLAGS += -Wall -Werror
+
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_VOICE_CONCURRENCY)),true)
LOCAL_CFLAGS += -DVOICE_CONCURRENCY
endif