aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-bt.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-11-22 12:39:58 +0100
committerGerd Hoffmann <kraxel@redhat.com>2011-11-22 13:38:12 +0100
commit2af2a1b8d05a1a64c5005ed930137632b9d5aa22 (patch)
tree48def53b1e3398c8be21922623aa6bb34d5cd6f1 /hw/usb-bt.c
parent40897c9c160393df922dfdb59cfa210048d3071d (diff)
downloadqemu-2af2a1b8d05a1a64c5005ed930137632b9d5aa22.zip
qemu-2af2a1b8d05a1a64c5005ed930137632b9d5aa22.tar.gz
qemu-2af2a1b8d05a1a64c5005ed930137632b9d5aa22.tar.bz2
usb: make usb_create_simple catch and pass up errors.
Use qdev_init() instead of qdev_init_nofail(), usb device initialization can fail, most common case being port and device speed mismatch. Handle failures correctly and pass up NULL pointers then. Also fixup usb_create_simple() callers (only one was buggy) to properly check for NULL pointers before referncing the usb_create_simple() return value. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-bt.c')
-rw-r--r--hw/usb-bt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index 529fa33..f30eec1 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -528,6 +528,9 @@ USBDevice *usb_bt_init(HCIInfo *hci)
if (!hci)
return NULL;
dev = usb_create_simple(NULL /* FIXME */, "usb-bt-dongle");
+ if (!dev) {
+ return NULL;
+ }
s = DO_UPCAST(struct USBBtState, dev, dev);
s->dev.opaque = s;