Commit 831b0e98 authored by Jimmy Brisson's avatar Jimmy Brisson Committed by laurenw-arm
Browse files

Don't return error information from console_flush



And from crash_console_flush.

We ignore the error information return by console_flush in _every_
place where we call it, and casting the return type to void does not
work around the MISRA violation that this causes. Instead, we collect
the error information from the driver (to avoid changing that API), and
don't return it to the caller.

Change-Id: I1e35afe01764d5c8f0efd04f8949d333ffb688c1
Signed-off-by: default avatarJimmy Brisson <jimmy.brisson@arm.com>
parent bb68a9d6
/* /*
* Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -23,7 +23,7 @@ void __dead2 __assert(const char *file, unsigned int line, ...@@ -23,7 +23,7 @@ void __dead2 __assert(const char *file, unsigned int line,
{ {
printf("ASSERT: %s:%d:%s\n", file, line, assertion); printf("ASSERT: %s:%d:%s\n", file, line, assertion);
backtrace("assert"); backtrace("assert");
(void)console_flush(); console_flush();
plat_panic_handler(); plat_panic_handler();
} }
#elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO #elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
...@@ -31,14 +31,14 @@ void __dead2 __assert(const char *file, unsigned int line) ...@@ -31,14 +31,14 @@ void __dead2 __assert(const char *file, unsigned int line)
{ {
printf("ASSERT: %s:%d\n", file, line); printf("ASSERT: %s:%d\n", file, line);
backtrace("assert"); backtrace("assert");
(void)console_flush(); console_flush();
plat_panic_handler(); plat_panic_handler();
} }
#else #else
void __dead2 __assert(void) void __dead2 __assert(void)
{ {
backtrace("assert"); backtrace("assert");
(void)console_flush(); console_flush();
plat_panic_handler(); plat_panic_handler();
} }
#endif #endif
/* /*
* Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -25,7 +25,7 @@ void __dead2 psci_system_off(void) ...@@ -25,7 +25,7 @@ void __dead2 psci_system_off(void)
psci_spd_pm->svc_system_off(); psci_spd_pm->svc_system_off();
} }
(void) console_flush(); console_flush();
/* Call the platform specific hook */ /* Call the platform specific hook */
psci_plat_pm_ops->system_off(); psci_plat_pm_ops->system_off();
...@@ -44,7 +44,7 @@ void __dead2 psci_system_reset(void) ...@@ -44,7 +44,7 @@ void __dead2 psci_system_reset(void)
psci_spd_pm->svc_system_reset(); psci_spd_pm->svc_system_reset();
} }
(void) console_flush(); console_flush();
/* Call the platform specific hook */ /* Call the platform specific hook */
psci_plat_pm_ops->system_reset(); psci_plat_pm_ops->system_reset();
...@@ -77,7 +77,7 @@ u_register_t psci_system_reset2(uint32_t reset_type, u_register_t cookie) ...@@ -77,7 +77,7 @@ u_register_t psci_system_reset2(uint32_t reset_type, u_register_t cookie)
if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_system_reset != NULL)) { if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_system_reset != NULL)) {
psci_spd_pm->svc_system_reset(); psci_spd_pm->svc_system_reset();
} }
(void) console_flush(); console_flush();
return (u_register_t) return (u_register_t)
psci_plat_pm_ops->system_reset2((int) is_vendor, reset_type, psci_plat_pm_ops->system_reset2((int) is_vendor, reset_type,
......
/* /*
* Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -78,8 +78,8 @@ func plat_crash_console_putc ...@@ -78,8 +78,8 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush() * void plat_crash_console_flush()
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : x0, x1 * Clobber list : x0, x1
* --------------------------------------------- * ---------------------------------------------
*/ */
......
...@@ -49,6 +49,6 @@ void arm_console_runtime_init(void) ...@@ -49,6 +49,6 @@ void arm_console_runtime_init(void)
void arm_console_runtime_end(void) void arm_console_runtime_end(void)
{ {
(void)console_flush(); console_flush();
(void)console_unregister(&fvp_runtime_console); (void)console_unregister(&fvp_runtime_console);
} }
...@@ -37,7 +37,7 @@ __dead2 void plat_arm_error_handler(int err) ...@@ -37,7 +37,7 @@ __dead2 void plat_arm_error_handler(int err)
break; break;
} }
(void)console_flush(); console_flush();
/* Setup the watchdog to reset the system as soon as possible */ /* Setup the watchdog to reset the system as soon as possible */
sp805_refresh(ARM_SP805_TWDG_BASE, 1U); sp805_refresh(ARM_SP805_TWDG_BASE, 1U);
......
/* /*
* Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -64,10 +64,10 @@ func plat_crash_console_putc ...@@ -64,10 +64,10 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush() * void plat_crash_console_flush()
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : r0 * Clobber list : r0
* --------------------------------------------- * ---------------------------------------------
*/ */
......
/* /*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -66,10 +66,10 @@ func plat_crash_console_putc ...@@ -66,10 +66,10 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush() * void plat_crash_console_flush()
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : r0 * Clobber list : r0
* --------------------------------------------- * ---------------------------------------------
*/ */
......
/* /*
* Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -43,7 +43,7 @@ void __init arm_console_boot_init(void) ...@@ -43,7 +43,7 @@ void __init arm_console_boot_init(void)
void arm_console_boot_end(void) void arm_console_boot_end(void)
{ {
(void)console_flush(); console_flush();
(void)console_unregister(&arm_boot_console); (void)console_unregister(&arm_boot_console);
} }
...@@ -62,5 +62,5 @@ void arm_console_runtime_init(void) ...@@ -62,5 +62,5 @@ void arm_console_runtime_init(void)
void arm_console_runtime_end(void) void arm_console_runtime_end(void)
{ {
(void)console_flush(); console_flush();
} }
...@@ -39,7 +39,7 @@ void bcm_console_boot_init(void) ...@@ -39,7 +39,7 @@ void bcm_console_boot_init(void)
void bcm_console_boot_end(void) void bcm_console_boot_end(void)
{ {
(void)console_flush(); console_flush();
(void)console_unregister(&bcm_boot_console); (void)console_unregister(&bcm_boot_console);
} }
...@@ -59,7 +59,7 @@ void bcm_console_runtime_init(void) ...@@ -59,7 +59,7 @@ void bcm_console_runtime_init(void)
void bcm_console_runtime_end(void) void bcm_console_runtime_end(void)
{ {
(void)console_flush(); console_flush();
(void)console_unregister(&bcm_runtime_console); (void)console_unregister(&bcm_runtime_console);
} }
...@@ -182,7 +182,7 @@ func plat_crash_console_putc ...@@ -182,7 +182,7 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush(void) * void plat_crash_console_flush(void)
* Function to flush crash console * Function to flush crash console
* Clobber list : x0, x1 * Clobber list : x0, x1
* --------------------------------------------- * ---------------------------------------------
......
...@@ -96,7 +96,7 @@ void plat_ea_handler(unsigned int ea_reason, uint64_t syndrome, void *cookie, ...@@ -96,7 +96,7 @@ void plat_ea_handler(unsigned int ea_reason, uint64_t syndrome, void *cookie,
#if HANDLE_EA_EL3_FIRST #if HANDLE_EA_EL3_FIRST
/* Skip backtrace for lower EL */ /* Skip backtrace for lower EL */
if (level != MODE_EL3) { if (level != MODE_EL3) {
(void)console_flush(); console_flush();
do_panic(); do_panic();
} }
#endif #endif
......
/* /*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -62,10 +62,10 @@ func plat_crash_console_putc ...@@ -62,10 +62,10 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush() * void plat_crash_console_flush()
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : x0, x1 * Clobber list : x0, x1
* --------------------------------------------- * ---------------------------------------------
*/ */
......
/* /*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -66,10 +66,10 @@ func plat_crash_console_putc ...@@ -66,10 +66,10 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush() * void plat_crash_console_flush()
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : x0, x1 * Clobber list : x0, x1
* --------------------------------------------- * ---------------------------------------------
*/ */
......
/* /*
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -65,10 +65,10 @@ func plat_crash_console_putc ...@@ -65,10 +65,10 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush() * void plat_crash_console_flush()
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : r0 * Clobber list : r0
* --------------------------------------------- * ---------------------------------------------
*/ */
......
/* /*
* Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -84,6 +84,5 @@ getc_error: ...@@ -84,6 +84,5 @@ getc_error:
endfunc console_imx_uart_getc endfunc console_imx_uart_getc
func console_imx_uart_flush func console_imx_uart_flush
mov x0, #0
ret ret
endfunc console_imx_uart_flush endfunc console_imx_uart_flush
/* /*
* Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -72,6 +72,5 @@ getc_error: ...@@ -72,6 +72,5 @@ getc_error:
endfunc console_lpuart_getc endfunc console_lpuart_getc
func console_lpuart_flush func console_lpuart_flush
mov x0, #0
ret ret
endfunc console_lpuart_flush endfunc console_lpuart_flush
/* /*
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -214,11 +214,11 @@ func console_ls_16550_getc ...@@ -214,11 +214,11 @@ func console_ls_16550_getc
endfunc console_ls_16550_getc endfunc console_ls_16550_getc
/* --------------------------------------------- /* ---------------------------------------------
* int console_ls_16550_core_flush(uintptr_t base_addr) * void console_ls_16550_core_flush(uintptr_t base_addr)
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* In : x0 - console base address * In : x0 - console base address
* Out : return -1 on error else return 0. * Out : void
* Clobber list : x0, x1 * Clobber list : x0, x1
* --------------------------------------------- * ---------------------------------------------
*/ */
...@@ -234,16 +234,15 @@ func console_ls_16550_core_flush ...@@ -234,16 +234,15 @@ func console_ls_16550_core_flush
cmp w1, #(UARTLSR_TEMT | UARTLSR_THRE) cmp w1, #(UARTLSR_TEMT | UARTLSR_THRE)
b.ne 1b b.ne 1b
mov w0, #0
ret ret
endfunc console_ls_16550_core_flush endfunc console_ls_16550_core_flush
/* --------------------------------------------- /* ---------------------------------------------
* int console_ls_16550_flush(console_t *console) * void console_ls_16550_flush(console_t *console)
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* In : x0 - pointer to console_t structure * In : x0 - pointer to console_t structure
* Out : return -1 on error else return 0. * Out : void
* Clobber list : x0, x1 * Clobber list : x0, x1
* --------------------------------------------- * ---------------------------------------------
*/ */
......
/* /*
* Copyright (c) 2020, ARM Limited. All rights reserved.
* Copyright (C) 2018 Marvell International Ltd. * Copyright (C) 2018 Marvell International Ltd.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
...@@ -90,10 +91,10 @@ func plat_crash_console_putc ...@@ -90,10 +91,10 @@ func plat_crash_console_putc
endfunc plat_crash_console_putc endfunc plat_crash_console_putc
/* --------------------------------------------- /* ---------------------------------------------
* int plat_crash_console_flush() * void plat_crash_console_flush()
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : r0 * Clobber list : r0
* --------------------------------------------- * ---------------------------------------------
*/ */
......
/* /*
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -49,7 +49,7 @@ void marvell_console_boot_init(void) ...@@ -49,7 +49,7 @@ void marvell_console_boot_init(void)
void marvell_console_boot_end(void) void marvell_console_boot_end(void)
{ {
(void)console_flush(); console_flush();
(void)console_unregister(&marvell_boot_console); (void)console_unregister(&marvell_boot_console);
} }
...@@ -70,7 +70,7 @@ void marvell_console_runtime_init(void) ...@@ -70,7 +70,7 @@ void marvell_console_runtime_init(void)
void marvell_console_runtime_end(void) void marvell_console_runtime_end(void)
{ {
(void)console_flush(); console_flush();
(void)console_unregister(&marvell_runtime_console); (void)console_unregister(&marvell_runtime_console);
} }
/* /*
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -149,16 +149,15 @@ getc_error: ...@@ -149,16 +149,15 @@ getc_error:
endfunc console_core_getc endfunc console_core_getc
/* --------------------------------------------- /* ---------------------------------------------
* int console_core_flush(uintptr_t base_addr) * void console_core_flush(uintptr_t base_addr)
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* In : x0 - console base address * In : x0 - console base address
* Out : return -1 on error else return 0. * Out : void.
* Clobber list : x0, x1 * Clobber list : x0, x1
* --------------------------------------------- * ---------------------------------------------
*/ */
func console_core_flush func console_core_flush
/* Placeholder */ /* Placeholder */
mov w0, #0
ret ret
endfunc console_core_flush endfunc console_core_flush
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment