diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index f58d8135aab2..d773dd440a45 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -1144,6 +1144,17 @@ EXPORT_SYMBOL_GPL(iommu_add_device); void iommu_del_device(struct device *dev) { + /* + * Some devices might not have IOMMU table and group + * and we needn't detach them from the associated + * IOMMU groups + */ + if (!dev->iommu_group) { + pr_debug("iommu_tce: skipping device %s with no tbl\n", + dev_name(dev)); + return; + } + iommu_group_remove_device(dev); } EXPORT_SYMBOL_GPL(iommu_del_device);