[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/41] audio: Clean up inappropriate and unreachable
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 15/41] audio: Clean up inappropriate and unreachable use of hw_error() |
Date: |
Wed, 13 Jan 2016 16:43:13 +0100 |
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 <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
---
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) {
--
2.4.3
- [Qemu-devel] [PULL 00/41] Error reporting patches for 2016-01-13, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 01/41] error: Document how to accumulate multiple errors, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 03/41] hw: Inline the qdev_prop_set_drive_nofail() wrapper, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 09/41] error: Don't append a newline when printing the error hint, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 08/41] raven: Mark use of hw_error() in realize() FIXME, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 15/41] audio: Clean up inappropriate and unreachable use of hw_error(),
Markus Armbruster <=
- [Qemu-devel] [PULL 24/41] test-throttle: Simplify qemu_init_main_loop() error handling, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 20/41] error: Use error_report_err() instead of ad hoc prints, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 13/41] isa: Clean up error handling around isa_bus_new(), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 18/41] error: Use error_report_err() where appropriate (again), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 21/41] error: Improve documentation, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 36/41] vhdx: Fix "log that needs to be replayed" error message, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 02/41] Use error_fatal to simplify obvious fatal errors, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 05/41] omap: Don't use hw_error() in device init() methods, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 07/41] etraxfs_eth: Don't use hw_error() in init() method, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 11/41] sysbus: Don't use hw_error() in machine_init_done_notifiers, Markus Armbruster, 2016/01/13