Skip to content

Commit

Permalink
iommu/vt-d: Check the return value of iommu_device_create()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicholas Krause authored and Joerg Roedel committed Jan 7, 2016
1 parent 1683098 commit 5920337
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/iommu/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5920337

Please sign in to comment.