From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mWD-0007Q9-5H for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:07:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8mW8-0007aU-By for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:07:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8mW8-0007aQ-7T for qemu-devel@nongnu.org; Tue, 15 Dec 2015 05:07:36 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id C257E37C38A for ; Tue, 15 Dec 2015 10:07:35 +0000 (UTC) Message-ID: <1450174054.24446.0.camel@redhat.com> From: Gerd Hoffmann Date: Tue, 15 Dec 2015 11:07:34 +0100 In-Reply-To: <1449743372-17169-12-git-send-email-armbru@redhat.com> References: <1449743372-17169-1-git-send-email-armbru@redhat.com> <1449743372-17169-12-git-send-email-armbru@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 11/12] audio: Clean up inappropriate and unreachable use of hw_error() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On Do, 2015-12-10 at 11:29 +0100, Markus Armbruster wrote: > audio_init() should not use hw_error(), because dumping CPU registers > is unhelpful there, and aborting is wrong, because it can be called > called from an audio device's realize() method. >=20 > The two uses of hw_error() come from commit 0d9acba: >=20 > * When qemu_new_timer() fails. It couldn't fail back then, and it > can't fail now. Drop the unreachable error handling. >=20 > * When no_audio_driver can't be initialized. It couldn't fail back > then, and it can't fail now. Replace the error handling by an > assertion. >=20 > Cc: Gerd Hoffmann > Signed-off-by: Markus Armbruster Reviewed-by: Gerd Hoffmann > --- > audio/audio.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) >=20 > diff --git a/audio/audio.c b/audio/audio.c > index 5be4b15..9b855ed 100644 > --- a/audio/audio.c > +++ b/audio/audio.c > @@ -1806,9 +1806,6 @@ static void audio_init (void) > atexit (audio_atexit); > =20 > s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); > - if (!s->ts) { > - hw_error("Could not create audio timer\n"); > - } > =20 > audio_process_options ("AUDIO", audio_options); > =20 > @@ -1859,12 +1856,8 @@ static void audio_init (void) > =20 > if (!done) { > done =3D !audio_driver_init (s, &no_audio_driver); > - if (!done) { > - hw_error("Could not initialize audio subsystem\n"); > - } > - else { > - dolog ("warning: Using timer based audio emulation\n"); > - } > + assert(done); > + dolog ("warning: Using timer based audio emulation\n"); > } > =20 > if (conf.period.hertz <=3D 0) {