]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: pcnet: Replace memset+malloc with calloc
authorMarek Vasut <marek.vasut@gmail.com>
Sun, 17 May 2020 16:24:15 +0000 (18:24 +0200)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Mon, 29 Jun 2020 20:36:35 +0000 (22:36 +0200)
This combination of functions can be replaced with calloc(),
make it so.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/pcnet.c

index 72b93806244897acddf6e9bfbdb00063e60ea3ed..b670cff2aae03408ee2fc9806881c17d39eb228f 100644 (file)
@@ -184,12 +184,11 @@ int pcnet_initialize(bd_t *bis)
                /*
                 * Allocate and pre-fill the device structure.
                 */
-               dev = (struct eth_device *)malloc(sizeof(*dev));
+               dev = calloc(1, sizeof(*dev));
                if (!dev) {
                        printf("pcnet: Can not allocate memory\n");
                        break;
                }
-               memset(dev, 0, sizeof(*dev));
                dev->priv = (void *)(unsigned long)devbusfn;
                sprintf(dev->name, "pcnet#%d", dev_nr);