Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce903a07 authored by Satya Krishna Pindiproli's avatar Satya Krishna Pindiproli Committed by Gerrit - the friendly Code Review server
Browse files

hal: Handle pcm_start failures for hfp

- If pcm_start fails for any reason, hfp ignores the failure.
- This could lead to issues as the failures are not handled.
- Return appropriate error and break execution when pcm_start fails.

CRs-Fixed: 684608
Change-Id: Iad43b3d3e3e71e7191d41bbea317f2079d57784a
parent 6420a92e
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -200,10 +200,26 @@ static int32_t start_hfp(struct audio_device *adev,
        ret = -EIO;
        goto exit;
    }
    pcm_start(hfpmod.hfp_sco_rx);
    pcm_start(hfpmod.hfp_sco_tx);
    pcm_start(hfpmod.hfp_pcm_rx);
    pcm_start(hfpmod.hfp_pcm_tx);
    if (pcm_start(hfpmod.hfp_sco_rx) < 0) {
        ALOGE("%s: pcm start for hfp sco rx failed", __func__);
        ret = -EINVAL;
        goto exit;
    }
    if (pcm_start(hfpmod.hfp_sco_tx) < 0) {
        ALOGE("%s: pcm start for hfp sco tx failed", __func__);
        ret = -EINVAL;
        goto exit;
    }
    if (pcm_start(hfpmod.hfp_pcm_rx) < 0) {
        ALOGE("%s: pcm start for hfp pcm rx failed", __func__);
        ret = -EINVAL;
        goto exit;
    }
    if (pcm_start(hfpmod.hfp_pcm_tx) < 0) {
        ALOGE("%s: pcm start for hfp pcm tx failed", __func__);
        ret = -EINVAL;
        goto exit;
    }

    hfpmod.is_hfp_running = true;
    hfp_set_volume(adev, hfpmod.hfp_volume);