2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 01:04:08 +08:00

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>
This commit is contained in:
Nicholas Krause 2016-01-04 18:27:57 -05:00 committed by Joerg Roedel
parent 168309855a
commit 592033790e

View 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: