fix(xilinx): update correct return types
Refactor the return types to ensure code correctness and compliance
for DT console.
Change-Id: I11dc3afbe168a78ddc03427df3f5f8d10fe40d40
Signed-off-by: Prasad Kummari <prasad.kummari@amd.com>
diff --git a/plat/xilinx/common/plat_console.c b/plat/xilinx/common/plat_console.c
index 2488836..b84912a 100644
--- a/plat/xilinx/common/plat_console.c
+++ b/plat/xilinx/common/plat_console.c
@@ -109,7 +109,7 @@
{
uintptr_t base_addr;
const char *com;
- uint32_t ret = 0;
+ int32_t ret = 0;
com = fdt_getprop(dtb, node, "compatible", NULL);
if (com != NULL) {
@@ -144,7 +144,7 @@
*/
static int fdt_get_uart_info(dt_uart_info_t *info)
{
- int node, ret = 0;
+ int node = 0, ret = 0;
void *dtb = (void *)XILINX_OF_BOARD_DTB_ADDR;
ret = is_valid_dtb(dtb);
@@ -178,9 +178,9 @@
*
* Return: On success, it returns 0; on failure, it returns an error+reason.
*/
-static int check_fdt_uart_info(dt_uart_info_t *info)
+static int32_t check_fdt_uart_info(dt_uart_info_t *info)
{
- uint32_t ret = 0;
+ int32_t ret = 0;
if (info->status == 0) {
ret = -ENODEV;
@@ -219,7 +219,7 @@
static void setup_runtime_console(uint32_t clock, dt_uart_info_t *info)
{
static console_t bl31_runtime_console;
- uint32_t rc;
+ int32_t rc;
#if defined(PLAT_zynqmp)
rc = console_cdns_register(info->base,
@@ -260,6 +260,7 @@
rc = fdt_get_uart_info(uart_info);
if (rc < 0) {
rc = -FDT_ERR_NOTFOUND;
+ goto error;
}
if (strncmp(uart_info->compatible, DT_UART_COMPAT,
@@ -283,13 +284,14 @@
WARN("BL31: No console device found in DT.\n");
}
+error:
return rc;
}
#endif
void setup_console(void)
{
- uint32_t rc;
+ int32_t rc;
uint32_t uart_clk = get_uart_clk();
#if defined(PLAT_zynqmp)