omap iommu: Exit iteration if no possibility of available area
authorHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Thu, 6 May 2010 14:09:25 +0000 (17:09 +0300)
committerHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Fri, 14 May 2010 07:23:37 +0000 (10:23 +0300)
Searching avaialable spaces should be stopped as soon as it turns out
that there's no possibility with the rest of it.

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
arch/arm/plat-omap/iovmm.c

index 5afe0135b979c1c95ef0d9c19378a9aa276c2626..e43983ba59c5eb77ac61caa3a2ebaca83b50416c 100644 (file)
@@ -287,7 +287,10 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da,
        prev_end = 0;
        list_for_each_entry(tmp, &obj->mmap, list) {
 
-               if ((prev_end < start) && (start + bytes < tmp->da_start))
+               if (prev_end >= start)
+                       break;
+
+               if (start + bytes < tmp->da_start)
                        goto found;
 
                if (flags & IOVMF_DA_ANON)