wm8750: add record buffer underrun check

Reported-by: niuguoxiang@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170901131409.6712-1-kraxel@redhat.com
This commit is contained in:
Gerd Hoffmann 2017-09-01 15:14:09 +02:00
parent f75637badd
commit 4bb3893908
1 changed files with 5 additions and 1 deletions

View File

@ -680,8 +680,12 @@ uint32_t wm8750_adc_dat(void *opaque)
WM8750State *s = (WM8750State *) opaque;
uint32_t *data;
if (s->idx_in >= sizeof(s->data_in))
if (s->idx_in >= sizeof(s->data_in)) {
wm8750_in_load(s);
if (s->idx_in >= sizeof(s->data_in)) {
return 0x80008000; /* silence in AUD_FMT_S16 sample format */
}
}
data = (uint32_t *) &s->data_in[s->idx_in];
s->req_in -= 4;