From: Aurelien Jarno Date: Mon, 14 Sep 2009 23:16:28 +0000 (+0200) Subject: hw/serial: don't create a char device if none is specified X-Git-Tag: v0.12.0-rc0~1091 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=387f4a5a7193e8f8df17d2cfc360a4067dd2d675;p=thirdparty%2Fqemu.git 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 --- diff --git a/hw/serial.c b/hw/serial.c index 6f7b30e48ad..1f4ce771913 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);