summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2020-03-26 16:08:31 +0100
committerJoerg Roedel <jroedel@suse.de>2020-03-27 11:14:51 +0100
commit72acd9df18f12420001f901493c54b7364f34d60 (patch)
treedf733bf8cdb5925e99ef528f615ec65c770d5d70 /drivers/iommu/iommu.c
parent045a70426067d6a22e3e5745b55efc18fa75aabf (diff)
downloadlinux-stable-72acd9df18f12420001f901493c54b7364f34d60.tar.gz
linux-stable-72acd9df18f12420001f901493c54b7364f34d60.tar.bz2
linux-stable-72acd9df18f12420001f901493c54b7364f34d60.zip
iommu: Move iommu_fwspec to struct dev_iommu
Move the iommu_fwspec pointer in struct device into struct dev_iommu. This is a step in the effort to reduce the iommu related pointers in struct device to one. Signed-off-by: Joerg Roedel <jroedel@suse.de> Tested-by: Will Deacon <will@kernel.org> # arm-smmu Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200326150841.10083-7-joro@8bytes.org
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 15d64a175d92..2b471419e26c 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2405,6 +2405,9 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
if (fwspec)
return ops == fwspec->ops ? 0 : -EINVAL;
+ if (!dev_iommu_get(dev))
+ return -ENOMEM;
+
/* Preallocate for the overwhelmingly common case of 1 ID */
fwspec = kzalloc(struct_size(fwspec, ids, 1), GFP_KERNEL);
if (!fwspec)