qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 1/2] wm8750: add record buffer underrun check
Date: Mon, 18 Sep 2017 13:17:49 +0200	[thread overview]
Message-ID: <20170918111750.15965-2-kraxel@redhat.com> (raw)
In-Reply-To: <20170918111750.15965-1-kraxel@redhat.com>

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(-)

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;
-- 
2.9.3

  reply	other threads:[~2017-09-18 11:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 11:17 [Qemu-devel] [PULL 0/2] Audio 20170918 patches Gerd Hoffmann
2017-09-18 11:17 ` Gerd Hoffmann [this message]
2017-09-18 11:17 ` [Qemu-devel] [PULL 2/2] audio: intel-hda: do not use old_mmio accesses Gerd Hoffmann
2017-09-18 12:19 ` [Qemu-devel] [PULL 0/2] Audio 20170918 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170918111750.15965-2-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).