serial: fix multi-pci card error cleanup.
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 6 May 2015 10:58:19 +0000 (12:58 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 19 May 2015 10:47:08 +0000 (12:47 +0200)
commita48da7b5bc1f0c98e7a124337140efd47049066c
treeb33e1d8c96d39b42d99c901d52ab9b189a5de3b5
parentfaa261a7fb254866bdd5b6a25ad94677945f21b4
serial: fix multi-pci card error cleanup.

Put the number of serial ports into a local variable in
multi_serial_pci_realize, then increment the port count
(pci->ports) as we initialize the serial port cores.

Now pci->ports always holds the number of successfully
initialized ports and we can use multi_serial_pci_exit
to properly cleanup the already initialized bits in case
of a init failure.

https://bugzilla.redhat.com/show_bug.cgi?id=970551

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
hw/char/serial-pci.c