Skip to content

Commit 293aa9e

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Handle error path in amd_iommu_probe_device()
Do not try to set max_pasids in error path as dev_data is not allocated. Fixes: a0c47f2 ("iommu/amd: Introduce iommu_dev_data.max_pasids") Signed-off-by: Vasant Hegde <[email protected]> Reviewed-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 95eb6a0 commit 293aa9e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,11 +2187,12 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
21872187
dev_err(dev, "Failed to initialize - trying to proceed anyway\n");
21882188
iommu_dev = ERR_PTR(ret);
21892189
iommu_ignore_device(iommu, dev);
2190-
} else {
2191-
amd_iommu_set_pci_msi_domain(dev, iommu);
2192-
iommu_dev = &iommu->iommu;
2190+
goto out_err;
21932191
}
21942192

2193+
amd_iommu_set_pci_msi_domain(dev, iommu);
2194+
iommu_dev = &iommu->iommu;
2195+
21952196
/*
21962197
* If IOMMU and device supports PASID then it will contain max
21972198
* supported PASIDs, else it will be zero.
@@ -2203,6 +2204,7 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
22032204
pci_max_pasids(to_pci_dev(dev)));
22042205
}
22052206

2207+
out_err:
22062208
iommu_completion_wait(iommu);
22072209

22082210
return iommu_dev;

0 commit comments

Comments
 (0)