mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +00:00
audio_hw: Prevent referencing input devices from empty list
Fixes audioserver crash in in_get_capture_position() if PCM input device was not properly opened. Signed-off-by: Vasyl Gello <vasek.gello@gmail.com> Change-Id: I2f2d9bc8151cf61af112a9544268513effacacb5
This commit is contained in:
parent
884938a258
commit
d758a17389
1 changed files with 10 additions and 0 deletions
|
@ -1181,6 +1181,11 @@ static int32_t update_echo_reference(struct stream_in *in, size_t frames)
|
|||
b.delay_ns = 0;
|
||||
struct pcm_device *pcm_device;
|
||||
|
||||
if (list_empty(&in->pcm_dev_list)) {
|
||||
ALOGW("%s: pcm device list empty", __func__);
|
||||
return b.delay_ns;
|
||||
}
|
||||
|
||||
pcm_device = node_to_item(list_head(&in->pcm_dev_list),
|
||||
struct pcm_device, stream_list_node);
|
||||
|
||||
|
@ -3485,6 +3490,11 @@ static int in_get_capture_position(const struct audio_stream_in *stream,
|
|||
struct pcm_device *pcm_device;
|
||||
int ret = -ENOSYS;
|
||||
|
||||
if (list_empty(&in->pcm_dev_list)) {
|
||||
ALOGW("%s: pcm device list empty", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
pcm_device = node_to_item(list_head(&in->pcm_dev_list),
|
||||
struct pcm_device, stream_list_node);
|
||||
|
||||
|
|
Loading…
Reference in a new issue