hal: Ensure all the mutexes are initialized
- Ensure all the mutex locks are initialized before using them,
to avoid native crashes.
Change-Id: I7b6253f1d08a36a24d366d69004ce969d73c13e1
CRs-Fixed: 654375
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 2f67784..f40db8f 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2530,6 +2530,8 @@
in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
+ pthread_mutex_init(&in->lock, (const pthread_mutexattr_t *) NULL);
+
in->stream.common.get_sample_rate = in_get_sample_rate;
in->stream.common.set_sample_rate = in_set_sample_rate;
in->stream.common.get_buffer_size = in_get_buffer_size;
@@ -2664,6 +2666,8 @@
adev = calloc(1, sizeof(struct audio_device));
+ pthread_mutex_init(&adev->lock, (const pthread_mutexattr_t *) NULL);
+
adev->device.common.tag = HARDWARE_DEVICE_TAG;
adev->device.common.version = AUDIO_DEVICE_API_VERSION_2_0;
adev->device.common.module = (struct hw_module_t *)module;