[PATCH] ddr:altera:soc64: Integer fix overflow that caused DDR size mismatched
dinesh.maniyam at intel.com
dinesh.maniyam at intel.com
Tue May 10 08:15:33 CEST 2022
From: Dinesh Maniyam <dinesh.maniyam at intel.com>
Convert the constant integer to 'phys_size_t' to avoid overflow
when calculating the SDRAM size.
Signed-off-by: Chee Hong Ang <chee.hong.ang at intel.com>
Signed-off-by: Dinesh Maniyam <dinesh.maniyam at intel.com>
---
drivers/ddr/altera/sdram_soc64.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c
index d6baac2410..1f479c514d 100644
--- a/drivers/ddr/altera/sdram_soc64.c
+++ b/drivers/ddr/altera/sdram_soc64.c
@@ -239,7 +239,8 @@ phys_size_t sdram_calculate_size(struct altera_sdram_plat *plat)
{
u32 dramaddrw = hmc_readl(plat, DRAMADDRW);
- phys_size_t size = 1 << (DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) +
+ phys_size_t size = (phys_size_t)1 <<
+ (DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) +
DRAMADDRW_CFG_BANK_GRP_ADDR_WIDTH(dramaddrw) +
DRAMADDRW_CFG_BANK_ADDR_WIDTH(dramaddrw) +
DRAMADDRW_CFG_ROW_ADDR_WIDTH(dramaddrw) +
--
2.26.2
More information about the U-Boot
mailing list