summaryrefslogtreecommitdiffstats
path: root/hw
authorAnthony Liguori <[email protected]>2011-06-27 16:27:15 (GMT)
committer Anthony Liguori <[email protected]>2011-06-27 16:27:15 (GMT)
commitc45d1fc191bba333086f066247dd6096175db0da (patch) (side-by-side diff)
treea979bc5dcdf7d305e65541f8ffb1982e47c7d3ee /hw
parentcd59dd8734bebe5bd06be8a3fa79a9f4facf6633 (diff)
parentd2e4d08b3e02deb2d5824b17283c63c1354b7696 (diff)
downloadqemu-kvm-c45d1fc191bba333086f066247dd6096175db0da.zip
qemu-kvm-c45d1fc191bba333086f066247dd6096175db0da.tar.gz
qemu-kvm-c45d1fc191bba333086f066247dd6096175db0da.tar.bz2
Merge remote-tracking branch 'amit/for-anthony' into staging
Diffstat (limited to 'hw') (more/less context) (ignore whitespace changes)
-rw-r--r--hw/virtio-serial-bus.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index bff4004..7f6db7b 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -328,18 +328,11 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
cpkt.event = lduw_p(&gcpkt->event);
cpkt.value = lduw_p(&gcpkt->value);
- port = find_port_by_id(vser, ldl_p(&gcpkt->id));
- if (!port && cpkt.event != VIRTIO_CONSOLE_DEVICE_READY)
- return;
-
- info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info);
-
- switch(cpkt.event) {
- case VIRTIO_CONSOLE_DEVICE_READY:
+ if (cpkt.event == VIRTIO_CONSOLE_DEVICE_READY) {
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding device %s",
vser->bus.qbus.name);
- break;
+ return;
}
/*
* The device is up, we can now tell the device about all the
@@ -348,8 +341,19 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
QTAILQ_FOREACH(port, &vser->ports, next) {
send_control_event(port, VIRTIO_CONSOLE_PORT_ADD, 1);
}
- break;
+ return;
+ }
+ port = find_port_by_id(vser, ldl_p(&gcpkt->id));
+ if (!port) {
+ error_report("virtio-serial-bus: Unexpected port id %u for device %s\n",
+ ldl_p(&gcpkt->id), vser->bus.qbus.name);
+ return;
+ }
+
+ info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info);
+
+ switch(cpkt.event) {
case VIRTIO_CONSOLE_PORT_READY:
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding port %u for device %s",