pdev->domain = dom0;
ret = iommu_add_device(pdev);
if ( ret )
+ {
+ pdev->domain = NULL;
goto out;
+ }
list_add(&pdev->domain_list, &dom0->arch.pdev_list);
pci_enable_acs(pdev);
int pci_remove_device(u8 bus, u8 devfn)
{
- struct pci_dev *pdev, *tmp;
+ struct pci_dev *pdev;
int ret = -ENODEV;
spin_lock(&pcidevs_lock);
- list_for_each_entry_safe ( pdev, tmp, &alldevs_list, alldevs_list )
+ list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
if ( pdev->bus == bus && pdev->devfn == devfn )
{
ret = iommu_remove_device(pdev);
pdev->domain = dom0;
ret = iommu_add_device(pdev);
if ( ret )
+ {
+ pdev->domain = NULL;
goto out;
+ }
list_add(&pdev->domain_list, &dom0->arch.pdev_list);
pci_enable_acs(pdev);