Update ethernetif.c
This commit is contained in:
parent
aa0b68a575
commit
822df76f8e
|
@ -490,20 +490,15 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
|
||||||
#if LWIP_NETIF_HOSTNAME
|
#if LWIP_NETIF_HOSTNAME
|
||||||
#define LWIP_HOSTNAME_LEN 16
|
#define LWIP_HOSTNAME_LEN 16
|
||||||
char *hostname = RT_NULL;
|
char *hostname = RT_NULL;
|
||||||
netif = (struct netif*) rt_malloc (sizeof(struct netif) + LWIP_HOSTNAME_LEN);
|
netif = (struct netif*) rt_calloc (1, sizeof(struct netif) + LWIP_HOSTNAME_LEN);
|
||||||
#else
|
#else
|
||||||
netif = (struct netif*) rt_malloc (sizeof(struct netif));
|
netif = (struct netif*) rt_calloc (1, sizeof(struct netif));
|
||||||
#endif
|
#endif
|
||||||
if (netif == RT_NULL)
|
if (netif == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("malloc netif failed\n");
|
rt_kprintf("malloc netif failed\n");
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
#if LWIP_NETIF_HOSTNAME
|
|
||||||
rt_memset(netif, 0, sizeof(struct netif) + LWIP_HOSTNAME_LEN);
|
|
||||||
#else
|
|
||||||
rt_memset(netif, 0, sizeof(struct netif));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* set netif */
|
/* set netif */
|
||||||
dev->netif = netif;
|
dev->netif = netif;
|
||||||
|
|
Loading…
Reference in New Issue