[PATCH 2/2] ARM: dma-mapping: don't detach devices without an IOMMU during teardown
Will Deacon
will.deacon at arm.com
Mon Jan 12 09:23:33 PST 2015
When tearing down the DMA ops for a device via of_dma_deconfigure, we
unconditionally detach the device from its IOMMU domain. For devices
that aren't actually behind an IOMMU, this produces a "Not attached"
warning message on the console.
This patch changes the teardown code so that we don't detach from the
IOMMU domain when there isn't an IOMMU dma mapping to start with.
Repoerted-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Signed-off-by: Will Deacon <will.deacon at arm.com>
---
arch/arm/mm/dma-mapping.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 7864797609b3..711c3d2802fb 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -2023,7 +2023,10 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
static void arm_teardown_iommu_dma_ops(struct device *dev)
{
- struct dma_iommu_mapping *mapping = dev->archdata.mapping;
+ struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
+
+ if (!mapping)
+ return;
arm_iommu_detach_device(dev);
arm_iommu_release_mapping(mapping);
--
2.1.4
More information about the linux-arm-kernel
mailing list