]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iommu/vt-d: Check the return value of iommu_device_create()
authorNicholas Krause <xerofoify@gmail.com>
Mon, 4 Jan 2016 23:27:57 +0000 (18:27 -0500)
committerJoerg Roedel <jroedel@suse.de>
Thu, 7 Jan 2016 12:43:56 +0000 (13:43 +0100)
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>
drivers/iommu/dmar.c

index 80e3c176008e511ec75c1771758b63de8ad39d9d..add177a37f000772824e890e6a737f1d0b152402 100644 (file)
@@ -1070,6 +1070,12 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
                                                       intel_iommu_groups,
                                                       "%s", iommu->name);
 
+       if (IS_ERR(iommu->iommu_dev)) {
+               drhd->iommu = NULL;
+               err = PTR_ERR(iommu->iommu_dev);
+               goto err_unmap;
+       }
+
        return 0;
 
 err_unmap: