mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
usb-bus: convert USBDeviceClass init to realize
Add "realize/unrealize" in USBDeviceClass, which has errp as a parameter. So all the implementations now use error_setg instead of error_report for reporting error. Note: this patch still keep "init" in USBDeviceClass, and call kclass->init in usb_device_realize(), avoid breaking git bisect. After realize all usb devices, will be removed. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
dc1f598845
commit
7d553f27fc
6 changed files with 81 additions and 50 deletions
|
@ -549,12 +549,17 @@ static void usb_msd_handle_data(USBDevice *dev, USBPacket *p)
|
|||
static void usb_msd_password_cb(void *opaque, int err)
|
||||
{
|
||||
MSDState *s = opaque;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!err)
|
||||
err = usb_device_attach(&s->dev);
|
||||
if (!err) {
|
||||
usb_device_attach(&s->dev, &local_err);
|
||||
}
|
||||
|
||||
if (err)
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
qdev_unplug(&s->dev.qdev, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue