Slight improvements in Mbed TLS shared heap helpers
This patch, firstly, makes the error messages consistent to how printed strings are usually formatted. Secondly, it removes an unnecessary #if directive. Change-Id: Idbb8ef0070562634766b683ac65f8160c9d109e6 Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
This commit is contained in:
parent
783fd8e00f
commit
7af2dd2ef6
|
@ -167,8 +167,6 @@ int arm_dyn_tb_fw_cfg_init(void *dtb, int *node)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if TRUSTED_BOARD_BOOT && LOAD_IMAGE_V2
|
|
||||||
/*
|
/*
|
||||||
* Reads and returns the Mbed TLS shared heap information from the DTB.
|
* Reads and returns the Mbed TLS shared heap information from the DTB.
|
||||||
* This function is supposed to be called *only* when a DTB is present.
|
* This function is supposed to be called *only* when a DTB is present.
|
||||||
|
@ -187,8 +185,7 @@ int arm_get_dtb_mbedtls_heap_info(void *dtb, void **heap_addr,
|
||||||
/* Verify the DTB is valid and get the root node */
|
/* Verify the DTB is valid and get the root node */
|
||||||
err = arm_dyn_tb_fw_cfg_init(dtb, &dtb_root);
|
err = arm_dyn_tb_fw_cfg_init(dtb, &dtb_root);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
ERROR("%s: Invalid TB_FW_CONFIG. Cannot retrieve Mbed TLS "
|
ERROR("Invalid TB_FW_CONFIG. Cannot retrieve Mbed TLS heap information from DTB\n");
|
||||||
"heap information from DTB\n", __func__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,14 +193,14 @@ int arm_get_dtb_mbedtls_heap_info(void *dtb, void **heap_addr,
|
||||||
err = fdtw_read_cells(dtb, dtb_root,
|
err = fdtw_read_cells(dtb, dtb_root,
|
||||||
DTB_PROP_MBEDTLS_HEAP_ADDR, 2, heap_addr);
|
DTB_PROP_MBEDTLS_HEAP_ADDR, 2, heap_addr);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
ERROR("%s: error while reading %s from DTB\n", __func__,
|
ERROR("Error while reading %s from DTB\n",
|
||||||
DTB_PROP_MBEDTLS_HEAP_ADDR);
|
DTB_PROP_MBEDTLS_HEAP_ADDR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
err = fdtw_read_cells(dtb, dtb_root,
|
err = fdtw_read_cells(dtb, dtb_root,
|
||||||
DTB_PROP_MBEDTLS_HEAP_SIZE, 1, heap_size);
|
DTB_PROP_MBEDTLS_HEAP_SIZE, 1, heap_size);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
ERROR("%s: error while reading %s from DTB\n", __func__,
|
ERROR("Error while reading %s from DTB\n",
|
||||||
DTB_PROP_MBEDTLS_HEAP_SIZE);
|
DTB_PROP_MBEDTLS_HEAP_SIZE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -234,8 +231,7 @@ int arm_set_dtb_mbedtls_heap_info(void *dtb, void *heap_addr, size_t heap_size)
|
||||||
*/
|
*/
|
||||||
err = arm_dyn_tb_fw_cfg_init(dtb, &dtb_root);
|
err = arm_dyn_tb_fw_cfg_init(dtb, &dtb_root);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
ERROR("%s: Invalid TB_FW_CONFIG loaded. Unable to get "
|
ERROR("Invalid TB_FW_CONFIG loaded. Unable to get root node\n");
|
||||||
"root node\n", __func__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,19 +245,18 @@ int arm_set_dtb_mbedtls_heap_info(void *dtb, void *heap_addr, size_t heap_size)
|
||||||
err = fdtw_write_inplace_cells(dtb, dtb_root,
|
err = fdtw_write_inplace_cells(dtb, dtb_root,
|
||||||
DTB_PROP_MBEDTLS_HEAP_ADDR, 2, &heap_addr);
|
DTB_PROP_MBEDTLS_HEAP_ADDR, 2, &heap_addr);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
ERROR("%s: unable to write DTB property %s\n",
|
ERROR("Unable to write DTB property %s\n",
|
||||||
__func__, DTB_PROP_MBEDTLS_HEAP_ADDR);
|
DTB_PROP_MBEDTLS_HEAP_ADDR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = fdtw_write_inplace_cells(dtb, dtb_root,
|
err = fdtw_write_inplace_cells(dtb, dtb_root,
|
||||||
DTB_PROP_MBEDTLS_HEAP_SIZE, 1, &heap_size);
|
DTB_PROP_MBEDTLS_HEAP_SIZE, 1, &heap_size);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
ERROR("%s: unable to write DTB property %s\n",
|
ERROR("Unable to write DTB property %s\n",
|
||||||
__func__, DTB_PROP_MBEDTLS_HEAP_SIZE);
|
DTB_PROP_MBEDTLS_HEAP_SIZE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* TRUSTED_BOARD_BOOT && LOAD_IMAGE_V2 */
|
|
||||||
|
|
Loading…
Reference in New Issue