summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-12-07 02:04:36 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-12-07 02:04:36 +0000
commit2f63868d37013764dbd82104462485e3411b0ff7 (patch)
tree8bfe7ea441bccda633f4c8cfb434fdb080c7b495
parent27c4ad39273be05dc875eac24521e23e2653ed89 (diff)
parent506fd42a89494c836eda69df354177affa0820f8 (diff)
downloadandroid_hardware_qcom_audio-2f63868d37013764dbd82104462485e3411b0ff7.tar.gz
android_hardware_qcom_audio-2f63868d37013764dbd82104462485e3411b0ff7.tar.bz2
android_hardware_qcom_audio-2f63868d37013764dbd82104462485e3411b0ff7.zip
Snap for 6055731 from 506fd42a89494c836eda69df354177affa0820f8 to qt-qpr2-release
Change-Id: Ib2b29116e660e856772b3562e667a223fd06fd38
-rw-r--r--hal/audio_hw.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 1c99066f..17bb6f63 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -6282,12 +6282,10 @@ static int adev_verify_devices(struct audio_device *adev)
static int adev_close(hw_device_t *device)
{
size_t i;
- struct audio_device *adev_temp = (struct audio_device *)device;
-
- if (!adev_temp)
- return 0;
pthread_mutex_lock(&adev_init_lock);
+ if (!device || ((struct audio_device *)device != adev))
+ goto done;
if ((--audio_device_ref_count) == 0) {
audio_extn_snd_mon_unregister_listener(adev);
@@ -6306,10 +6304,11 @@ static int adev_close(hw_device_t *device)
adev->adm_deinit(adev->adm_data);
pthread_mutex_destroy(&adev->lock);
free(device);
+ adev = NULL;
}
+done:
pthread_mutex_unlock(&adev_init_lock);
-
return 0;
}