diff mbox series

[18/30] net: eepro100: Switch from malloc()+memset() to calloc()

Message ID 20200523163837.407592-18-marek.vasut+renesas@gmail.com
State New
Headers show
Series [01/30] net: eepro100: Remove EEPRO100_SROM_WRITE | expand

Commit Message

Marek Vasut May 23, 2020, 4:38 p.m. UTC
Replace malloc()+memset() combination with calloc(), no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
---
 drivers/net/eepro100.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ramon Fried May 23, 2020, 5:16 p.m. UTC | #1
On Sat, May 23, 2020 at 7:42 PM Marek Vasut <marek.vasut at gmail.com> wrote:
>
> Replace malloc()+memset() combination with calloc(), no functional change.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> ---
>  drivers/net/eepro100.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
> index 74b09e9afd..8fa665743a 100644
> --- a/drivers/net/eepro100.c
> +++ b/drivers/net/eepro100.c
> @@ -746,12 +746,11 @@ int eepro100_initialize(bd_t *bis)
>                         continue;
>                 }
>
> -               dev = (struct eth_device *)malloc(sizeof(*dev));
> +               dev = calloc(1, sizeof(*dev));
>                 if (!dev) {
>                         printf("eepro100: Can not allocate memory\n");
>                         break;
>                 }
> -               memset(dev, 0, sizeof(*dev));
>
>                 sprintf(dev->name, "i82559#%d", card_number);
>                 dev->priv = (void *)devno; /* this have to come before bus_to_phys() */
> --
> 2.25.1
>
Reviewed-By: Ramon Fried <rfried.dev at gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 74b09e9afd..8fa665743a 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -746,12 +746,11 @@  int eepro100_initialize(bd_t *bis)
 			continue;
 		}
 
-		dev = (struct eth_device *)malloc(sizeof(*dev));
+		dev = calloc(1, sizeof(*dev));
 		if (!dev) {
 			printf("eepro100: Can not allocate memory\n");
 			break;
 		}
-		memset(dev, 0, sizeof(*dev));
 
 		sprintf(dev->name, "i82559#%d", card_number);
 		dev->priv = (void *)devno; /* this have to come before bus_to_phys() */