The flags in struct console_device have to be initialized
to zero. Otherwise the following can happen:
- console_register sets the initial baudrate of a new console
before we set the global console init state to CONSOLE_INIT_FULL.
- In console_baudrate_set we test whether the current console is
active which may be true because of unitialized flags.
- we then call getc() to wait for the user to accept the new settings
and we are stuck because of the CONSOLE_UNINITIALIZED state
we will never get anything from getc().
Looking back this explains some cases for me when barebox refused
to start and I really wonder why this did not become a more visible
problem before.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
To allow for some generic io accessors introduce io.h and use
this instead of asm/io.h throughout the tree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The idea is to panic() when there is no memory available for normal
operation. Exception: code which can consume arbitrary amount of RAM
(example: files allocated in ramfs) must report error instead of panic().
This patch also fixes code which didn't check for NULL from malloc() etc.
Usage: malloc(), memalign() return NULL when out of RAM.
xmalloc(), xmemalign() always return non-NULL or panic().
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>