fix(st): update dt_get_ddr_size() type
Move to size_t to ensure a generic algorithm whatever the platform
architecture.
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Change-Id: I7879367849ed86750dcff2b6a15f4b998bf6da18
Signed-off-by: Sebastien PASDELOUP <sebastien.pasdeloup-ext@st.com>
diff --git a/plat/st/common/stm32mp_dt.c b/plat/st/common/stm32mp_dt.c
index 34d52e1..1cbf51b 100644
--- a/plat/st/common/stm32mp_dt.c
+++ b/plat/st/common/stm32mp_dt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -228,9 +228,9 @@
* This function gets DDR size information from the DT.
* Returns value in bytes on success, and 0 on failure.
******************************************************************************/
-uint32_t dt_get_ddr_size(void)
+size_t dt_get_ddr_size(void)
{
- static uint32_t size;
+ static size_t size;
int node;
if (size != 0U) {
@@ -240,12 +240,12 @@
node = fdt_node_offset_by_compatible(fdt, -1, DT_DDR_COMPAT);
if (node < 0) {
INFO("%s: Cannot read DDR node in DT\n", __func__);
- return 0;
+ return 0U;
}
- size = fdt_read_uint32_default(fdt, node, "st,mem-size", 0U);
+ size = (size_t)fdt_read_uint32_default(fdt, node, "st,mem-size", 0U);
- flush_dcache_range((uintptr_t)&size, sizeof(uint32_t));
+ flush_dcache_range((uintptr_t)&size, sizeof(size_t));
return size;
}