[1/4] omap iommu: Check existence of arch_iommu

Message ID 1301066005-7882-1-git-send-email-sakari.ailus@maxwell.research.nokia.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Sakari Ailus March 25, 2011, 3:13 p.m. UTC
  Check that the arch_iommu has been installed before trying to use it. This
will lead to kernel oops if the arch_iommu isn't there.

Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
---
 arch/arm/plat-omap/iommu.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
  

Comments

Sakari Ailus March 25, 2011, 3:19 p.m. UTC | #1
Sakari Ailus wrote:
> Check that the arch_iommu has been installed before trying to use it. This
> will lead to kernel oops if the arch_iommu isn't there.

This was intended to go to linux-omap. Sorry for the noise.
  

Patch

diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index b1107c0..f0fea0b 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -104,6 +104,9 @@  static int iommu_enable(struct iommu *obj)
 	if (!obj)
 		return -EINVAL;
 
+	if (!arch_iommu)
+		return -ENOENT;
+
 	clk_enable(obj->clk);
 
 	err = arch_iommu->enable(obj);