xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen/arm: ioremap_attr: return NULL is __vmap failed
@ 2013-11-15 15:27 Julien Grall
  2013-11-15 15:27 ` [PATCH] xen/arm: Panic if platform initialization failed Julien Grall
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Julien Grall @ 2013-11-15 15:27 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, ian.campbell, Julien Grall, patches

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>
---
 xen/arch/arm/mm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 26c6768..5137668 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -742,8 +742,13 @@ 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;
 
-    return (__vmap(&pfn, nr, 1, 1, attributes) + offs);
+    ptr = __vmap(&pfn, nr, 1, 1, attributes);
+    if ( ptr == NULL )
+        return NULL;
+
+    return (ptr + offs);
 }
 
 void *ioremap(paddr_t pa, size_t len)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-11-19 16:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 15:27 [PATCH] xen/arm: ioremap_attr: return NULL is __vmap failed Julien Grall
2013-11-15 15:27 ` [PATCH] xen/arm: Panic if platform initialization failed Julien Grall
2013-11-15 15:59   ` Stefano Stabellini
2013-11-19 14:50     ` Ian Campbell
2013-11-15 15:27 ` [PATCH] xen/arm: Panic if we are unable to initialize platform timer Julien Grall
2013-11-15 15:58   ` Stefano Stabellini
2013-11-19 14:47     ` Ian Campbell
2013-11-19 16:39       ` Julien Grall
2013-11-15 15:45 ` [PATCH] xen/arm: ioremap_attr: return NULL is __vmap failed Andrew Cooper
2013-11-15 16:04 ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).