Commit 293aa9ec authored by Vasant Hegde's avatar Vasant Hegde Committed by Joerg Roedel

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: a0c47f23 ("iommu/amd: Introduce iommu_dev_data.max_pasids")
Signed-off-by: default avatarVasant Hegde <vasant.hegde@amd.com>
Reviewed-by: default avatarSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/20240828111029.5429-5-vasant.hegde@amd.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 95eb6a05
...@@ -2187,11 +2187,12 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev) ...@@ -2187,11 +2187,12 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
dev_err(dev, "Failed to initialize - trying to proceed anyway\n"); dev_err(dev, "Failed to initialize - trying to proceed anyway\n");
iommu_dev = ERR_PTR(ret); iommu_dev = ERR_PTR(ret);
iommu_ignore_device(iommu, dev); iommu_ignore_device(iommu, dev);
} else { goto out_err;
amd_iommu_set_pci_msi_domain(dev, iommu);
iommu_dev = &iommu->iommu;
} }
amd_iommu_set_pci_msi_domain(dev, iommu);
iommu_dev = &iommu->iommu;
/* /*
* If IOMMU and device supports PASID then it will contain max * If IOMMU and device supports PASID then it will contain max
* supported PASIDs, else it will be zero. * supported PASIDs, else it will be zero.
...@@ -2203,6 +2204,7 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev) ...@@ -2203,6 +2204,7 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
pci_max_pasids(to_pci_dev(dev))); pci_max_pasids(to_pci_dev(dev)));
} }
out_err:
iommu_completion_wait(iommu); iommu_completion_wait(iommu);
return iommu_dev; return iommu_dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment