]> git.sur5r.net Git - u-boot/commitdiff
net: emaclite: Use calloc instead of malloc
authorMichal Simek <monstr@monstr.eu>
Thu, 25 Aug 2011 10:28:47 +0000 (12:28 +0200)
committerMichal Simek <monstr@monstr.eu>
Mon, 3 Oct 2011 06:04:14 +0000 (08:04 +0200)
Simplify driver logic and clear eth_device structure
in one command.

Signed-off-by: Michal Simek <monstr@monstr.eu>
drivers/net/xilinx_emaclite.c

index 2a5c5e16f584c893b9d398a438cce34d788298d7..28aab972b8154b17db9d5b64fc9eb7a16adc7fdc 100644 (file)
@@ -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;