Patchwork [U-Boot,03/26] net: emaclite: Use calloc instead of malloc

login
register
mail settings
Submitter Michal Simek
Date Sept. 13, 2011, 7:09 a.m.
Message ID <1315897821-23049-4-git-send-email-monstr@monstr.eu>
Download mbox | patch
Permalink /patch/114434/
State Rejected
Headers show

Comments

Michal Simek - Sept. 13, 2011, 7:09 a.m.
Simplify driver logic and clear eth_device structure
in one command.

Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 drivers/net/xilinx_emaclite.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 2a5c5e1..28aab97 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -344,11 +344,10 @@  int xilinx_emaclite_initialize (bd_t *bis, int base_addr)
 {
 	struct eth_device *dev;
 
-	dev = malloc(sizeof(*dev));
+	dev = calloc(1, sizeof(*dev));
 	if (dev == NULL)
 		return -1;
 
-	memset(dev, 0, sizeof(*dev));
 	sprintf(dev->name, "Xelite.%x", base_addr);
 
 	dev->iobase = base_addr;