aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2008-04-25 14:28:55 -0400
committerNicolas Pitre <nico@cam.org>2008-04-28 15:57:41 -0400
commitfd153abb01c3fbcc47cd4ac3c0bc8801cfcc0009 (patch)
tree938413e50e7a5afcd96f1c9a8d9c732f2397d758
parentc5a1e8f7091c33c7f6b53f070d13380facab6607 (diff)
[ARM] Orion: fix ioremap() optimization
The ioremap() optimization used for internal register didn't cope with the fact that paddr + size can wrap to zero if the area extends to the end of the physical address space. Issue isolated by Sylver Bruneau <sylver.bruneau@googlemail.com>. Signed-off-by: Nicolas Pitre <nico@marvell.com>
-rw-r--r--include/asm-arm/arch-orion5x/io.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/include/asm-arm/arch-orion5x/io.h b/include/asm-arm/arch-orion5x/io.h
index 5148ab7ad1f8..50f8c8802206 100644
--- a/include/asm-arm/arch-orion5x/io.h
+++ b/include/asm-arm/arch-orion5x/io.h
@@ -20,11 +20,10 @@ static inline void __iomem *
20__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype) 20__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
21{ 21{
22 void __iomem *retval; 22 void __iomem *retval;
23 23 unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE;
24 if (mtype == MT_DEVICE && size && paddr >= ORION5X_REGS_PHYS_BASE && 24 if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE &&
25 paddr + size <= ORION5X_REGS_PHYS_BASE + ORION5X_REGS_SIZE) { 25 size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) {
26 retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + 26 retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;
27 (paddr - ORION5X_REGS_PHYS_BASE);
28 } else { 27 } else {
29 retval = __arm_ioremap(paddr, size, mtype); 28 retval = __arm_ioremap(paddr, size, mtype);
30 } 29 }