From aca605f4f99d6eb887a6aec7a1432865f399bb3e Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 4 Nov 2011 16:27:04 +0800 Subject: [PATCH] ENGR00158360 imx MSL: fix __arch_adjust_zones function fix __arch_adjust_zones if MXC_DMA_ZONE_SIZE if bigger than system memory Signed-off-by: Jason Chen --- arch/arm/plat-mxc/include/mach/memory.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h index 5a1721592900..55b08d9fc7fc 100755 --- a/arch/arm/plat-mxc/include/mach/memory.h +++ b/arch/arm/plat-mxc/include/mach/memory.h @@ -82,11 +82,15 @@ static inline void __arch_adjust_zones(unsigned long *zone_size, unsigned long *zhole_size) { +#ifdef CONFIG_ZONE_DMA /* Create separate zone to reserve memory for DMA */ - zone_size[1] = zone_size[0] - MXC_DMA_ZONE_SIZE; - zone_size[0] = MXC_DMA_ZONE_SIZE; - zhole_size[1] = zhole_size[0]; - zhole_size[0] = 0; + if ((zone_size[0] - zhole_size[0]) > MXC_DMA_ZONE_SIZE) { + zone_size[1] = zone_size[0] - MXC_DMA_ZONE_SIZE; + zone_size[0] = MXC_DMA_ZONE_SIZE; + zhole_size[1] = zhole_size[0]; + zhole_size[0] = 0; + } +#endif } #define arch_adjust_zones(size, holes) \ -- 2.39.5