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>
This commit is contained in:
@@ -242,11 +242,9 @@ int smc911x_initialize(u8 dev_num, int base_addr)
|
|||||||
unsigned long addrl, addrh;
|
unsigned long addrl, addrh;
|
||||||
struct eth_device *dev;
|
struct eth_device *dev;
|
||||||
|
|
||||||
dev = malloc(sizeof(*dev));
|
dev = calloc(1, sizeof(*dev));
|
||||||
if (!dev) {
|
if (!dev)
|
||||||
return -1;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
memset(dev, 0, sizeof(*dev));
|
|
||||||
|
|
||||||
dev->iobase = base_addr;
|
dev->iobase = base_addr;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user