diff options
author | Marek Vasut <marek.vasut+renesas@gmail.com> | 2020-03-15 15:14:18 +0100 |
---|---|---|
committer | marex <marex@desktop.lan> | 2020-05-01 12:35:21 +0200 |
commit | 882d5f6983ff23b6f09899bb43d6dfd90ed7492f (patch) | |
tree | 28fd4bd9734a698c4ba286462a05779235a1e961 /drivers/net/smc911x.c | |
parent | 9c211e3b055ce809ac81ea4f849594ffb6f77df4 (diff) | |
download | u-boot-882d5f6983ff23b6f09899bb43d6dfd90ed7492f.tar.gz u-boot-882d5f6983ff23b6f09899bb43d6dfd90ed7492f.tar.xz u-boot-882d5f6983ff23b6f09899bb43d6dfd90ed7492f.zip |
net: smc911x: Replace malloc()+memset() with calloc()
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 <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/net/smc911x.c')
-rw-r--r-- | drivers/net/smc911x.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 24b4eaeb3f..2c72e3469d 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -242,11 +242,9 @@ int smc911x_initialize(u8 dev_num, int base_addr) unsigned long addrl, addrh; struct eth_device *dev; - dev = malloc(sizeof(*dev)); - if (!dev) { - return -1; - } - memset(dev, 0, sizeof(*dev)); + dev = calloc(1, sizeof(*dev)); + if (!dev) + return -ENOMEM; dev->iobase = base_addr; |