Wieland Hoffmann <themineo@googlemail.com>
Douglas Schilling Landgraf <dougsland@redhat.com>
Tom Vijlbrief <tom.vijlbrief@xs4all.nl>
+ Shradha Shah <sshah@solarflare.com>
[....send patches to get your name here....]
virDomainDefPtr def)
{
pciDeviceList *pcidevs;
- int i;
int ret = -1;
if (!def->nhostdevs)
if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs)))
return -1;
- for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
- pciDevice *dev = pciDeviceListGet(pcidevs, i);
+ while (pciDeviceListCount(pcidevs) > 0) {
+ pciDevice *dev = pciDeviceListGet(pcidevs, 0);
pciDeviceListSteal(pcidevs, dev);
if (pciDeviceListAdd(driver->activePciHostdevs, dev) < 0) {
pciFreeDevice(dev);
}
/* Now steal all the devices from pcidevs */
- for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
- pciDevice *dev = pciDeviceListGet(pcidevs, i);
+ while (pciDeviceListCount(pcidevs) > 0) {
+ pciDevice *dev = pciDeviceListGet(pcidevs, 0);
pciDeviceListSteal(pcidevs, dev);
}
/* Only steal all the devices from driver->activePciHostdevs. We will
* free them in pciDeviceListFree().
*/
- for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
- pciDevice *dev = pciDeviceListGet(pcidevs, i);
+ while (pciDeviceListCount(pcidevs) > 0) {
+ pciDevice *dev = pciDeviceListGet(pcidevs, 0);
pciDeviceListSteal(driver->activePciHostdevs, dev);
}