]> git.sur5r.net Git - u-boot/commitdiff
powerpc/mpc85xx: explicit cast the SDRAM size to type phys_size_t
authorMingkai Hu <Mingkai.hu@freescale.com>
Fri, 12 Apr 2013 07:56:28 +0000 (15:56 +0800)
committerAndy Fleming <afleming@freescale.com>
Thu, 20 Jun 2013 18:51:24 +0000 (13:51 -0500)
To avoid sign extension problem, use explicit casting to cast
the SDRAM size to type phys_size_t, or else, if the SDRAM size
is 2G(0x80000000), it will be extended to 0xffffffff80000000
when phys_size_t is type 'unsigned long long'.

Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
arch/powerpc/cpu/mpc85xx/cpu.c

index 6ce483e17ae46eb69a29101f676af2c9f7420fe4..128daba2225dc500fb3b9fe77b8054a893730085 100644 (file)
@@ -341,7 +341,7 @@ phys_size_t initdram(int board_type)
 #if defined(CONFIG_SPD_EEPROM) || defined(CONFIG_DDR_SPD)
        return fsl_ddr_sdram_size();
 #else
-       return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+       return (phys_size_t)CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
 #endif
 }
 #else /* CONFIG_SYS_RAMBOOT */