diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-12-22 23:11:06 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-12-23 11:15:44 +0100 |
commit | 4b8750c95610f601ac7e8571713eab268877d224 (patch) | |
tree | 1dfd108d86add8d1d0fd34e01d4b431acbdc7da2 /drivers/serial/serial_imx.c | |
parent | f02a48ea00637025dc13d86d1ff024b6aec071d7 (diff) | |
download | barebox-4b8750c95610f601ac7e8571713eab268877d224.tar.gz barebox-4b8750c95610f601ac7e8571713eab268877d224.tar.xz |
uart drivers: use xzalloc instead of xmalloc
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>
Diffstat (limited to 'drivers/serial/serial_imx.c')
-rw-r--r-- | drivers/serial/serial_imx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c index 4923dcbd94..8547f36171 100644 --- a/drivers/serial/serial_imx.c +++ b/drivers/serial/serial_imx.c @@ -320,7 +320,7 @@ static int imx_serial_probe(struct device_d *dev) struct imx_serial_priv *priv; uint32_t val; - priv = xmalloc(sizeof(*priv)); + priv = xzalloc(sizeof(*priv)); cdev = &priv->cdev; priv->regs = dev_request_mem_region(dev, 0); |