From patchwork Wed Jan 13 15:43:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 567010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6A30014032B for ; Thu, 14 Jan 2016 02:49:37 +1100 (AEDT) Received: from localhost ([::1]:37731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJNfz-00078Y-3X for incoming@patchwork.ozlabs.org; Wed, 13 Jan 2016 10:49:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJNaP-000421-Fn for qemu-devel@nongnu.org; Wed, 13 Jan 2016 10:43:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJNaN-00017d-Um for qemu-devel@nongnu.org; Wed, 13 Jan 2016 10:43:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJNaN-00017D-PO for qemu-devel@nongnu.org; Wed, 13 Jan 2016 10:43:47 -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 637E0368E3; Wed, 13 Jan 2016 15:43:47 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-28.phx2.redhat.com [10.3.113.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0DFhjWF031417 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 13 Jan 2016 10:43:47 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9276C3002534; Wed, 13 Jan 2016 16:43:40 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 13 Jan 2016 16:43:13 +0100 Message-Id: <1452699819-26608-16-git-send-email-armbru@redhat.com> In-Reply-To: <1452699819-26608-1-git-send-email-armbru@redhat.com> References: <1452699819-26608-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Markus Armbruster , Gerd Hoffmann Subject: [Qemu-devel] [PULL 15/41] audio: Clean up inappropriate and unreachable use of hw_error() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. The two uses of hw_error() come from commit 0d9acba: * When qemu_new_timer() fails. It couldn't fail back then, and it can't fail now. Drop the unreachable error handling. * 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. Cc: Gerd Hoffmann Signed-off-by: Markus Armbruster Reviewed-by: Gerd Hoffmann --- audio/audio.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 5be4b15..a0fc8b3 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1806,9 +1806,6 @@ static void audio_init (void) atexit (audio_atexit); s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); - if (!s->ts) { - hw_error("Could not create audio timer\n"); - } audio_process_options ("AUDIO", audio_options); @@ -1859,12 +1856,8 @@ static void audio_init (void) if (!done) { done = !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"); } if (conf.period.hertz <= 0) {