]> git.ipfire.org Git - thirdparty/qemu.git/commit
usb: fail usbdevice_create() when there is no USB bus
authorStefan Hajnoczi <stefanha@redhat.com>
Sun, 25 Nov 2012 15:49:15 +0000 (16:49 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 3 Dec 2012 21:02:28 +0000 (15:02 -0600)
commitcd00334f1ae587aee146517af295adbfd7ab702a
tree8f2afbcb46af8f234580af507aa914246b3f7551
parent8c9283c82a8428018b2e43c5f5381a99d1648d4b
usb: fail usbdevice_create() when there is no USB bus

Report an error instead of segfaulting when attaching a USB device to a
machine with no USB busses:

  $ qemu-system-arm -machine vexpress-a9 \
      -sd Fedora-17-armhfp-vexpress-mmcblk0.img \
      -kernel vmlinuz-3.4.2-3.fc17.armv7hl \
      -initrd initramfs-3.4.2-3.fc17.armv7hl.img \
      -usbdevice disk:format=raw:test.img

Note that the vexpress-a9 machine does not have a USB host controller.

Reported-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit c128d6a6d785eb9235a4f6dbd52f405ab8c60bee)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/usb/bus.c