diff options
author | Nicholas Krause <xerofoify@gmail.com> | 2016-01-04 18:27:57 -0500 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2016-01-07 07:43:56 -0500 |
commit | 592033790e8276f7038efb480871598648464a01 (patch) | |
tree | 375165f1ab8b06e8071952edcab9f23b303a9300 | |
parent | 168309855a7d1e16db751e9c647119fe2d2dc878 (diff) |
iommu/vt-d: Check the return value of iommu_device_create()
This adds the proper check to alloc_iommu to make sure that
the call to iommu_device_create has completed successfully
and if not return the error code to the caller after freeing
up resources allocated previously.
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/dmar.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 80e3c176008e..add177a37f00 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -1070,6 +1070,12 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) | |||
1070 | intel_iommu_groups, | 1070 | intel_iommu_groups, |
1071 | "%s", iommu->name); | 1071 | "%s", iommu->name); |
1072 | 1072 | ||
1073 | if (IS_ERR(iommu->iommu_dev)) { | ||
1074 | drhd->iommu = NULL; | ||
1075 | err = PTR_ERR(iommu->iommu_dev); | ||
1076 | goto err_unmap; | ||
1077 | } | ||
1078 | |||
1073 | return 0; | 1079 | return 0; |
1074 | 1080 | ||
1075 | err_unmap: | 1081 | err_unmap: |