diff options
author | Krzysztof Halasa <khc@pm.waw.pl> | 2011-01-06 16:23:01 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-01-07 10:21:22 +0100 |
commit | c5baa0edc4a70c2f44cb7422e2b47ab5c96570ed (patch) | |
tree | d45c280198754e96276f6a633a206233504790b3 /drivers/serial/amba-pl011.c | |
parent | c99d28ca568a6e0d713c42bfbb9cd5310588d857 (diff) | |
download | barebox-c5baa0edc4a70c2f44cb7422e2b47ab5c96570ed.tar.gz barebox-c5baa0edc4a70c2f44cb7422e2b47ab5c96570ed.tar.xz |
Fix error handling with malloc, memalign etc. Introduce xmemalign().
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>
Diffstat (limited to 'drivers/serial/amba-pl011.c')
-rw-r--r-- | drivers/serial/amba-pl011.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index bc9b0def8e..442dbc4cab 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c @@ -157,8 +157,7 @@ static int pl011_probe(struct device_d *dev) struct amba_uart_port *uart; struct console_device *cdev; - uart = malloc(sizeof(struct amba_uart_port)); - + uart = xmalloc(sizeof(struct amba_uart_port)); uart->clk = clk_get(dev, NULL); if (IS_ERR(uart->clk)) |