summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2022-08-15 17:20:03 +0100
committerJoerg Roedel <jroedel@suse.de>2022-09-07 14:25:01 +0200
commitcbc040081fdf7d73ef60112b24caa785b3f293f3 (patch)
tree98d887b1aa98b79f62f35e9a68d2982464fd98d1 /drivers/iommu/amd
parentc919739ce4721ecf7b96b99253b032df30fcf19b (diff)
downloadlinux-stable-cbc040081fdf7d73ef60112b24caa785b3f293f3.tar.gz
linux-stable-cbc040081fdf7d73ef60112b24caa785b3f293f3.tar.bz2
linux-stable-cbc040081fdf7d73ef60112b24caa785b3f293f3.zip
iommu/amd: Handle race between registration and device probe
As for the Intel driver, make sure the AMD driver can cope with seeing .probe_device calls without having to wait for all known instances to register first. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/a8d8ebe12b411d28972f1ab928c6db92e8913cf5.1660572783.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd')
-rw-r--r--drivers/iommu/amd/iommu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 94220eb5bff3..85c4122b5d61 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1851,6 +1851,10 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
if (!iommu)
return ERR_PTR(-ENODEV);
+ /* Not registered yet? */
+ if (!iommu->iommu.ops)
+ return ERR_PTR(-ENODEV);
+
if (dev_iommu_priv_get(dev))
return &iommu->iommu;