From: Jason Chen Date: Fri, 4 Nov 2011 08:27:04 +0000 (+0800) Subject: ENGR00158360 imx MSL: fix __arch_adjust_zones function X-Git-Tag: v3.0.35-fsl~1953 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=aca605f4f99d6eb887a6aec7a1432865f399bb3e;p=karo-tx-linux.git 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 --- 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) \