Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/hypervisor/virhostdev.c | 8 +++++---
src/util/virpci.c | 6 +++---
src/util/virpci.h | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 3bfb04c674..4042f874d6 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -846,7 +846,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mgr,
VIR_DEBUG("Removing PCI device %s from inactive list",
virPCIDeviceGetName(pci));
- actual = virPCIDeviceListSteal(mgr->inactivePCIHostdevs, pci);
+ actual = virPCIDeviceListSteal(mgr->inactivePCIHostdevs,
virPCIDeviceGetAddress(pci));
VIR_DEBUG("Adding PCI device %s to active list",
virPCIDeviceGetName(pci));
@@ -918,7 +918,8 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mgr,
VIR_DEBUG("Removing PCI device %s from active list",
virPCIDeviceGetName(pci));
- if (!(actual = virPCIDeviceListSteal(mgr->activePCIHostdevs, pci)))
+ if (!(actual = virPCIDeviceListSteal(mgr->activePCIHostdevs,
+ virPCIDeviceGetAddress(pci))))
continue;
VIR_DEBUG("Adding PCI device %s to inactive list",
@@ -1022,7 +1023,8 @@ virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr mgr,
VIR_DEBUG("Removing PCI device %s from active list",
virPCIDeviceGetName(pci));
- actual = virPCIDeviceListSteal(mgr->activePCIHostdevs, pci);
+ actual = virPCIDeviceListSteal(mgr->activePCIHostdevs,
+ virPCIDeviceGetAddress(pci));
VIR_DEBUG("Adding PCI device %s to inactive list",
virPCIDeviceGetName(pci));
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 9544275c31..332e681c43 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1743,16 +1743,16 @@ virPCIDeviceListStealIndex(virPCIDeviceListPtr list,
virPCIDevicePtr
virPCIDeviceListSteal(virPCIDeviceListPtr list,
- virPCIDevicePtr dev)
+ virPCIDeviceAddressPtr devAddr)
{
- return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list,
&dev->address));
+ return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list, devAddr));
}
void
virPCIDeviceListDel(virPCIDeviceListPtr list,
virPCIDevicePtr dev)
{
- virPCIDeviceFree(virPCIDeviceListSteal(list, dev));
+ virPCIDeviceFree(virPCIDeviceListSteal(list, &dev->address));
}
int
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 628a293972..e3458a75fa 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -161,7 +161,7 @@ virPCIDevicePtr virPCIDeviceListGet(virPCIDeviceListPtr list,
int idx);
size_t virPCIDeviceListCount(virPCIDeviceListPtr list);
virPCIDevicePtr virPCIDeviceListSteal(virPCIDeviceListPtr list,
- virPCIDevicePtr dev);
+ virPCIDeviceAddressPtr devAddr);
virPCIDevicePtr virPCIDeviceListStealIndex(virPCIDeviceListPtr list,
int idx);
void virPCIDeviceListDel(virPCIDeviceListPtr list,
--
2.26.2