From: Markus Armbruster Date: Fri, 28 Jan 2011 10:21:36 +0000 (+0100) Subject: scsi hotplug: Set DriveInfo member bus correctly X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~6549 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31e1ea3ee7d05ab1aa134fe07a8f33b42417641f;p=sdk%2Femulator%2Fqemu.git scsi hotplug: Set DriveInfo member bus correctly drive_init() picks the first free bus and unit number, unless the user specifies them. This isn't a good fit for the drive_add monitor command, because there we specify the controller by PCI address instead of using bus number set by drive_init(). scsi_hot_add() takes care to replace the unit number set by drive_init() by the real one, but it neglects to replace the bus number. Thus, bus/unit in DriveInfo may be bogus. Affects drive_get() and drive_get_max_bus(). I'm not aware of anything bad happening because of that; looks like by the time we're hot-plugging, the two functions aren't used anymore. Fix it anyway. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 270a982..b6dcbda 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -90,6 +90,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, * specified). */ dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1); + dinfo->bus = scsibus->busnr; scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo->bdrv, dinfo->unit, false); if (!scsidev) { return -1;