From patchwork Sun Mar 15 16:58:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 243655 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sun, 15 Mar 2020 17:58:33 +0100 Subject: [PATCH 02/12] net: smc911x: Replace malloc()+memset() with calloc() In-Reply-To: <20200315165843.81753-1-marek.vasut+renesas@gmail.com> References: <20200315165843.81753-1-marek.vasut+renesas@gmail.com> Message-ID: <20200315165843.81753-3-marek.vasut+renesas@gmail.com> Replace combination of malloc()+memset() with calloc() as the behavior is exactly the same and the amount of code is reduced. Signed-off-by: Marek Vasut Cc: Joe Hershberger Cc: Masahiro Yamada Acked-by: Joe Hershberger --- drivers/net/smc911x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 24b4eaeb3f..a78b7817ac 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -242,11 +242,10 @@ int smc911x_initialize(u8 dev_num, int base_addr) unsigned long addrl, addrh; struct eth_device *dev; - dev = malloc(sizeof(*dev)); + dev = calloc(1, sizeof(*dev)); if (!dev) { return -1; } - memset(dev, 0, sizeof(*dev)); dev->iobase = base_addr;