[serial] Explicitly initialise serial console UART to NULL

When debugging is enabled for the device tree or memory map parsing
code, the active serial console UART variable will be accessed during
early initialisation, before the .bss section has been zeroed.

Place this variable in the .data section (by providing an explicit
initialiser), so that reading this variable is well defined even
during early initialisation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-07-30 13:40:36 +01:00
parent a814c46059
commit be551d420e

View File

@@ -61,8 +61,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define COMSPEED 0
#endif
/** Active serial console UART */
struct uart *serial_console;
/** Active serial console UART
*
* Explicitly initialised to @c NULL since this variable may be
* accessed before .bss has been zeroed.
*/
struct uart *serial_console = NULL;
/**
* Get fixed serial console UART