From patchwork Sun May 17 16:24:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 245919 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sun, 17 May 2020 18:24:15 +0200 Subject: [PATCH 05/15] net: pcnet: Replace memset+malloc with calloc In-Reply-To: <20200517162425.76584-1-marek.vasut+renesas@gmail.com> References: <20200517162425.76584-1-marek.vasut+renesas@gmail.com> Message-ID: <20200517162425.76584-5-marek.vasut+renesas@gmail.com> This combination of functions can be replaced with calloc(), make it so. Signed-off-by: Marek Vasut Cc: Daniel Schwierzeck Cc: Joe Hershberger --- drivers/net/pcnet.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index 5bbd290eec..f5e14ca60d 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -181,12 +181,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);