hal: add error check for voice call start
Add error check for pcm start during voice call start.
When pcm start fails dont start voice call, because voice path
is not setup.
CRs-Fixed: 2446818
Change-Id: I658c41da1ec457445cb3bb6481cb65c1bbe1e7eb
diff --git a/hal/voice.c b/hal/voice.c
index 847ce92..b0b75e5 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -289,8 +289,17 @@
if(adev->mic_break_enabled)
platform_set_mic_break_det(adev->platform, true);
- pcm_start(session->pcm_tx);
- pcm_start(session->pcm_rx);
+ ret = pcm_start(session->pcm_tx);
+ if (ret != 0) {
+ ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_tx));
+ goto error_start_voice;
+ }
+
+ ret = pcm_start(session->pcm_rx);
+ if (ret != 0) {
+ ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_rx));
+ goto error_start_voice;
+ }
/* Enable aanc only when no calls are active */
if (!voice_is_call_state_active(adev))