Fix initialisation of serial/parallel ports, spotted by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2447 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 03db2f8..eeb3513 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -569,9 +569,12 @@
/* Super I/O */
kbd_init();
rtc_state = rtc_init(0x70, 8);
- serial_init(&pic_set_irq_new, isa_pic, 0x3f8, 4, serial_hds[0]);
- serial_init(&pic_set_irq_new, isa_pic, 0x2f8, 4, serial_hds[0]);
- parallel_init(0x378, 7, parallel_hds[0]);
+ if (serial_hds[0])
+ serial_init(&pic_set_irq_new, isa_pic, 0x3f8, 4, serial_hds[0]);
+ if (serial_hds[1])
+ serial_init(&pic_set_irq_new, isa_pic, 0x2f8, 4, serial_hds[1]);
+ if (parallel_hds[0])
+ parallel_init(0x378, 7, parallel_hds[0]);
/* XXX: The floppy controller does not work correctly, something is
probably wrong.
floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table); */