From: Marek Vasut Date: Sun, 17 May 2020 14:26:57 +0000 (+0200) Subject: net: pcnet: Replace memset+malloc with calloc X-Git-Tag: v2025.01-rc5-pxa1908~2332^2~9^2~10 X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/%7B%7B%20%24style.Permalink%20%7D%7D?a=commitdiff_plain;h=ae38e96c23f3d08e2ec49206a99271252f5b3dc2;p=u-boot.git net: pcnet: Replace memset+malloc with calloc This combination of functions can be replaced with calloc(), make it so. Signed-off-by: Marek Vasut Cc: Daniel Schwierzeck Cc: Joe Hershberger --- diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index 72b9380624..b670cff2aa 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -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);