]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: ioremap_attr: return NULL is __vmap failed
authorJulien Grall <julien.grall@linaro.org>
Mon, 18 Nov 2013 13:08:23 +0000 (13:08 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 19 Nov 2013 16:00:03 +0000 (16:00 +0000)
Most of ioremap_* caller check if ioremap returns NULL. Actually, if the
physical address is non-aligned, Xen will return the pointer given by
__vmap plus the offset in the page. So if ioremap_* fails, the caller
will retrieve an non-NULL address and continue as if there was no error.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/mm.c

index 123280e82657bf569aed5a37eece8c481b9cd033..2de7dc7d0fce6155e99cd9eb3dae373a946eb9dd 100644 (file)
@@ -742,8 +742,12 @@ void *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes)
     unsigned long pfn = PFN_DOWN(pa);
     unsigned int offs = pa & (PAGE_SIZE - 1);
     unsigned int nr = PFN_UP(offs + len);
+    void *ptr = __vmap(&pfn, nr, 1, 1, attributes);
 
-    return (__vmap(&pfn, nr, 1, 1, attributes) + offs);
+    if ( ptr == NULL )
+        return NULL;
+
+    return ptr + offs;
 }
 
 void *ioremap(paddr_t pa, size_t len)