Message ID | 20170918111750.15965-2-kraxel@redhat.com |
---|---|
State | New |
Headers | show |
Series | [PULL,1/2] wm8750: add record buffer underrun check | expand |
diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index f8b5bebfc2..d2bf2e1da1 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -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;
Reported-by: niuguoxiang@huawei.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170901131409.6712-1-kraxel@redhat.com --- hw/audio/wm8750.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)