Skip to contentSkip to conversation

libxl: remove duplicate check for pci subsystem type

PATCH Jim Fehlig 1 participant 1 message Apr 24, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jim Fehlig

author
#1 lore raw
Quoted 8 lines · Olaf Hering

Both attach and detach functions get called only if the type matches.

---
 src/libxl/libxl_driver.c | 6 ------
 1 file changed, 6 deletions(-)

ACK. I think callers will always check the hostdev's subsys->type, calling the appropriate libxlDomain{Attach,Detach}Host<type>Device() function, so agreed there is no need to check it again.

I've pushed this one too. Thanks!

Regards,
Jim

Quoted 27 lines
src/libxl/libxl_driver.c +0 -6
index d76efda..f915f91 100644
@@ -2901,9 +2901,6 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
 
     libxl_device_pci_init(&pcidev);
 
-    if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
-        goto cleanup;
-
     if (virDomainHostdevFind(vm->def, hostdev, &found) >= 0) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("target pci device %.4x:%.2x:%.2x.%.1x already exists"),
@@ -3239,9 +3236,6 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
 
     libxl_device_pci_init(&pcidev);
 
-    if (subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
-        goto cleanup;
-
     idx = virDomainHostdevFind(vm->def, hostdev, &detach);
     if (idx < 0) {
         virReportError(VIR_ERR_OPERATION_FAILED,