omap: iommu: Gracefully fail iommu_enable if no arch_iommu is registered
authorMartin Hostettler <martin@neutronstar.dyndns.org>
Thu, 24 Feb 2011 20:51:31 +0000 (12:51 -0800)
committerTony Lindgren <tony@atomide.com>
Thu, 24 Feb 2011 20:51:31 +0000 (12:51 -0800)
In a modular build of the iommu code it's possible that the arch iommu code
isn't loaded when trying to enable the iommu. Instead of blindly following a
null pointer return -NODEV in that case.

Signed-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/plat-omap/iommu.c

index b1107c08da5605365992bc5906df5f6f361c0a24..3d8f55ea86667e37c03417b97c07fb785bf64f9c 100644 (file)
@@ -104,6 +104,9 @@ static int iommu_enable(struct iommu *obj)
        if (!obj)
                return -EINVAL;
 
+       if (!arch_iommu)
+               return -ENODEV;
+
        clk_enable(obj->clk);
 
        err = arch_iommu->enable(obj);