[PATCH 13/16] serial 16550: use xzalloc

Sascha Hauer s.hauer at pengutronix.de
Fri Apr 8 10:36:59 EDT 2011


No need to check for the result and increases the chance that we
build a binary without the rarely used calloc function.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/serial/serial_ns16550.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 290619f..ab172e7 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -211,9 +211,7 @@ static int ns16550_probe(struct device_d *dev)
 	if ((plat->reg_read == NULL) || (plat->reg_write == NULL))
 		return -EINVAL;
 
-	cdev = calloc(1, sizeof(struct console_device));
-	if (cdev == NULL)
-		return -ENOMEM;
+	cdev = xzalloc(sizeof(*cdev));
 
 	dev->type_data = cdev;
 	cdev->dev = dev;
-- 
1.7.2.3




More information about the barebox mailing list