mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
Fix -usbdevice crash
If -usbdevice is used on a machine with no USB busses, usb_create will fail and return NULL. Patch below handles this failure gracefully rather than crashing when we try to init the device. Signed-off-by: Paul Brook <paul@codesourcery.com>
This commit is contained in:
parent
23f2166d73
commit
d44168fffa
4 changed files with 12 additions and 0 deletions
|
@ -592,6 +592,9 @@ static USBDevice *usb_msd_init(const char *filename)
|
|||
|
||||
/* create guest device */
|
||||
dev = usb_create(NULL /* FIXME */, "usb-storage");
|
||||
if (!dev) {
|
||||
return NULL;
|
||||
}
|
||||
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
|
||||
if (qdev_init(&dev->qdev) < 0)
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue