Revision 18846dee hw/usb-msd.c
b/hw/usb-msd.c | ||
---|---|---|
532 | 532 |
/* |
533 | 533 |
* Hack alert: this pretends to be a block device, but it's really |
534 | 534 |
* a SCSI bus that can serve only a single device, which it |
535 |
* creates automatically. Two drive properties pointing to the
|
|
536 |
* same drive is not good: free_drive() dies for the second one.
|
|
537 |
* Zap the one we're not going to use.
|
|
535 |
* creates automatically. But first it needs to detach from its
|
|
536 |
* blockdev, or else scsi_bus_legacy_add_drive() dies when it
|
|
537 |
* attaches again.
|
|
538 | 538 |
* |
539 | 539 |
* The hack is probably a bad idea. |
540 | 540 |
*/ |
541 |
bdrv_detach(bs, &s->dev.qdev); |
|
541 | 542 |
s->conf.bs = NULL; |
542 | 543 |
|
543 | 544 |
s->dev.speed = USB_SPEED_FULL; |
... | ... | |
609 | 610 |
if (!dev) { |
610 | 611 |
return NULL; |
611 | 612 |
} |
612 |
qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv); |
|
613 |
if (qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv) < 0) { |
|
614 |
qdev_free(&dev->qdev); |
|
615 |
return NULL; |
|
616 |
} |
|
613 | 617 |
if (qdev_init(&dev->qdev) < 0) |
614 | 618 |
return NULL; |
615 | 619 |
|
Also available in: Unified diff