diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-18 14:28:10 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-18 14:28:10 +0000 |
commit | b47543c4f065e6cab06676a988a49c5d09229abe (patch) | |
tree | 7eb03e82e512972b150747ac7428fa5d1d191a1a /hw | |
parent | ceecf1d158d324c61a7ec1ba5de57dbc8a0f8373 (diff) |
serial: open a null device if the CharDriverState argument is null
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6366 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/serial.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/hw/serial.c b/hw/serial.c index 513ad27c90..02731770df 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -711,7 +711,7 @@ static void serial_init_core(SerialState *s, qemu_irq irq, int baudbase, { s->irq = irq; s->baudbase = baudbase; - s->chr = chr; + s->chr = chr ?: qemu_chr_open("null", "null", NULL); s->modem_status_poll = qemu_new_timer(vm_clock, (QEMUTimerCB *) serial_update_msl, s); @@ -721,6 +721,8 @@ static void serial_init_core(SerialState *s, qemu_irq irq, int baudbase, qemu_register_reset(serial_reset, s); serial_reset(s); + qemu_chr_add_handlers(s->chr, serial_can_receive1, serial_receive1, + serial_event, s); } /* If fd is zero, it means that the serial device uses the console */ @@ -739,8 +741,6 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, register_ioport_write(base, 8, 1, serial_ioport_write, s); register_ioport_read(base, 8, 1, serial_ioport_read, s); - qemu_chr_add_handlers(chr, serial_can_receive1, serial_receive1, - serial_event, s); return s; } @@ -837,8 +837,6 @@ SerialState *serial_mm_init (target_phys_addr_t base, int it_shift, serial_mm_write, s); cpu_register_physical_memory(base, 8 << it_shift, s_io_memory); } - qemu_chr_add_handlers(chr, serial_can_receive1, serial_receive1, - serial_event, s); serial_update_msl(s); return s; } |