aboutsummaryrefslogtreecommitdiff
path: root/hw/serial.c
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2009-09-15 01:16:28 +0200
committerAurelien Jarno <aurelien@aurel32.net>2009-09-15 01:16:28 +0200
commit387f4a5a7193e8f8df17d2cfc360a4067dd2d675 (patch)
tree4c8d89bf875bd6bc9502787bb14a2fe95221e36f /hw/serial.c
parente09fdfaf32231cf300534bfb8061f4244dd5c545 (diff)
downloadqemu-387f4a5a7193e8f8df17d2cfc360a4067dd2d675.zip
qemu-387f4a5a7193e8f8df17d2cfc360a4067dd2d675.tar.gz
qemu-387f4a5a7193e8f8df17d2cfc360a4067dd2d675.tar.bz2
hw/serial: don't create a char device if none is specified
When creating null devices, there is no way to ensure the unicity of the labels. Bail out with an error message instead. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/serial.c')
-rw-r--r--hw/serial.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/serial.c b/hw/serial.c
index 6f7b30e..1f4ce77 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -712,9 +712,14 @@ static void serial_reset(void *opaque)
static void serial_init_core(SerialState *s, qemu_irq irq, int baudbase,
CharDriverState *chr)
{
+ if (!chr) {
+ fprintf(stderr, "Can't create serial device, empty char device\n");
+ exit(1);
+ }
+
s->irq = irq;
s->baudbase = baudbase;
- s->chr = chr ?: qemu_chr_open("null", "null", NULL);
+ s->chr = chr;
s->modem_status_poll = qemu_new_timer(vm_clock, (QEMUTimerCB *) serial_update_msl, s);