usb: usb_create() can't fail, drop useless error handling
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
cd2d554127
commit
4806ec9b2c
@ -320,10 +320,6 @@ USBDevice *usb_create_simple(USBBus *bus, const char *name)
|
|||||||
USBDevice *dev = usb_create(bus, name);
|
USBDevice *dev = usb_create(bus, name);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
error_report("Failed to create USB device '%s'", name);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
rc = qdev_init(&dev->qdev);
|
rc = qdev_init(&dev->qdev);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
error_report("Failed to initialize USB device '%s'", name);
|
error_report("Failed to initialize USB device '%s'", name);
|
||||||
|
@ -530,14 +530,10 @@ static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
|
|||||||
} else {
|
} else {
|
||||||
hci = bt_new_hci(qemu_find_bt_vlan(0));
|
hci = bt_new_hci(qemu_find_bt_vlan(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hci)
|
if (!hci)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dev = usb_create(bus, name);
|
dev = usb_create(bus, name);
|
||||||
if (!dev) {
|
|
||||||
error_report("Failed to create USB device '%s'", name);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
s = DO_UPCAST(struct USBBtState, dev, dev);
|
s = DO_UPCAST(struct USBBtState, dev, dev);
|
||||||
s->hci = hci;
|
s->hci = hci;
|
||||||
if (qdev_init(&dev->qdev) < 0) {
|
if (qdev_init(&dev->qdev) < 0) {
|
||||||
|
@ -1405,9 +1405,6 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dev = usb_create(bus, "usb-net");
|
dev = usb_create(bus, "usb-net");
|
||||||
if (!dev) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
qdev_set_nic_properties(&dev->qdev, &nd_table[idx]);
|
qdev_set_nic_properties(&dev->qdev, &nd_table[idx]);
|
||||||
qdev_init_nofail(&dev->qdev);
|
qdev_init_nofail(&dev->qdev);
|
||||||
return dev;
|
return dev;
|
||||||
|
@ -544,9 +544,6 @@ static USBDevice *usb_serial_init(USBBus *bus, const char *filename)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dev = usb_create(bus, "usb-serial");
|
dev = usb_create(bus, "usb-serial");
|
||||||
if (!dev) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
|
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
|
||||||
if (vendorid)
|
if (vendorid)
|
||||||
qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
|
qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
|
||||||
|
@ -706,9 +706,6 @@ static USBDevice *usb_msd_init(USBBus *bus, const char *filename)
|
|||||||
|
|
||||||
/* create guest device */
|
/* create guest device */
|
||||||
dev = usb_create(bus, "usb-storage");
|
dev = usb_create(bus, "usb-storage");
|
||||||
if (!dev) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (qdev_prop_set_drive(&dev->qdev, "drive",
|
if (qdev_prop_set_drive(&dev->qdev, "drive",
|
||||||
blk_by_legacy_dinfo(dinfo)) < 0) {
|
blk_by_legacy_dinfo(dinfo)) < 0) {
|
||||||
object_unparent(OBJECT(dev));
|
object_unparent(OBJECT(dev));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user