From 4b8750c95610f601ac7e8571713eab268877d224 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 22 Dec 2011 23:11:06 +0100 Subject: 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 --- drivers/serial/serial_imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/serial/serial_imx.c') 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); -- cgit v1.2.3