Skip to content

Commit

Permalink
arm/tegra: Call bus_set_iommu() after iommu_device_register()
Browse files Browse the repository at this point in the history
The bus_set_iommu() function will call the add_device()
call-back which needs the iommu to be registered.

Reported-by: Jon Hunter <jonathanh@nvidia.com>
Fixes: 0b480e4 ('iommu/tegra: Add support for struct iommu_device')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Joerg Roedel committed Aug 30, 2017
1 parent c184ae8 commit 96302d8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/iommu/tegra-smmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,10 +949,6 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,

tegra_smmu_ahb_enable();

err = bus_set_iommu(&platform_bus_type, &tegra_smmu_ops);
if (err < 0)
return ERR_PTR(err);

err = iommu_device_sysfs_add(&smmu->iommu, dev, NULL, dev_name(dev));
if (err)
return ERR_PTR(err);
Expand All @@ -965,6 +961,13 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
return ERR_PTR(err);
}

err = bus_set_iommu(&platform_bus_type, &tegra_smmu_ops);
if (err < 0) {
iommu_device_unregister(&smmu->iommu);
iommu_device_sysfs_remove(&smmu->iommu);
return ERR_PTR(err);
}

if (IS_ENABLED(CONFIG_DEBUG_FS))
tegra_smmu_debugfs_init(smmu);

Expand Down

0 comments on commit 96302d8

Please sign in to comment.