hal: ultrasound: Handle `pcm_start()` failure

This matches stock audio HAL from veux.

Change-Id: If142a7e743bada1ee99c21d795c2a5bea412d966
This commit is contained in:
Alexander Winkowski 2024-10-11 16:11:54 +00:00
parent 34575d2877
commit 69fb36746a
No known key found for this signature in database
GPG Key ID: 72762A66704CDE44
1 changed files with 14 additions and 3 deletions

View File

@ -237,10 +237,21 @@ int us_start(void)
return -EIO;
}
pcm_start(us->rx_pcm);
pcm_start(us->tx_pcm);
us->state = ULTRASOUND_STATUS_STARTED;
if (pcm_start(us->rx_pcm) < 0) {
ALOGE("%s: pcm start for RX failed; error = %s", __func__,
pcm_get_error(us->rx_pcm));
stop_us();
return -EINVAL;
}
if (pcm_start(us->tx_pcm) < 0) {
ALOGE("%s: pcm start for TX failed; error = %s", __func__,
pcm_get_error(us->tx_pcm));
stop_us();
return -EINVAL;
}
us->state = ULTRASOUND_STATUS_STARTED;
ALOGD("%s: exit, status(0)", __func__);
return 0;