diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 1a112789..8c9c24b0 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -71,7 +71,7 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p, if ((conn != NULL) && (conn->recvmbox != SYS_MBOX_NULL)) { buf = memp_malloc(MEMP_NETBUF); - if (!buf) { + if (buf == NULL) { return 0; } pbuf_ref(p); diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 87a31fad..b71fb96d 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -245,14 +245,14 @@ ethernet_input(struct pbuf *p, struct netif *netif) etharp_arp_input(netif, (struct eth_addr*)(netif->hwaddr), p); break; -#if PPPOE_SUPPORT > 0 - case ETHTYPE_PPPOEDISC: /* PPP Over Ethernet Discovery Stage */ - pppoe_disc_input(netif, p); - break; - case ETHTYPE_PPPOE: /* PPP Over Ethernet Session Stage */ - pppoe_data_input(netif, p); - break; -#endif +#if PPPOE_SUPPORT + case ETHTYPE_PPPOEDISC: /* PPP Over Ethernet Discovery Stage */ + pppoe_disc_input(netif, p); + break; + case ETHTYPE_PPPOE: /* PPP Over Ethernet Session Stage */ + pppoe_data_input(netif, p); + break; +#endif /* PPPOE_SUPPORT */ default: pbuf_free(p); diff --git a/src/core/mem.c b/src/core/mem.c index b0885267..407d1a87 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -503,12 +503,12 @@ mem_malloc(mem_size_t size) void *mem_calloc(size_t count, size_t size) { - void *p; + void *p; - p = mem_malloc(count * size); - if(p) { - memset(p, 0, count * size); - } - return p; + p = mem_malloc(count * size); + if(p) { + memset(p, 0, count * size); + } + return p; } #endif /* !MEM_LIBC_MALLOC */ diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 9aae63ba..38383509 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -301,8 +301,9 @@ tcp_input(struct pbuf *p, struct netif *inp) } if (recv_data != NULL) { - if(flags & TCP_PSH) - recv_data->flgs |= PBUF_FLAG_PUSH; + if(flags & TCP_PSH) { + recv_data->flgs |= PBUF_FLAG_PUSH; + } /* Notify application that data has been received. */ TCP_EVENT_RECV(pcb, recv_data, ERR_OK, err); } diff --git a/src/include/lwip/mem.h b/src/include/lwip/mem.h index f80e3b97..36c8781b 100644 --- a/src/include/lwip/mem.h +++ b/src/include/lwip/mem.h @@ -83,8 +83,8 @@ void mem_init(void); void *mem_realloc(void *mem, mem_size_t size); #endif /* MEM_USE_POOLS */ void *mem_malloc(mem_size_t size); -void mem_free(void *mem); void *mem_calloc(size_t count, size_t size); +void mem_free(void *mem); #endif /* MEM_LIBC_MALLOC */ #ifndef LWIP_MEM_ALIGN_SIZE diff --git a/src/include/netif/etharp.h b/src/include/netif/etharp.h index 52a3e8b9..6b763c4c 100644 --- a/src/include/netif/etharp.h +++ b/src/include/netif/etharp.h @@ -119,8 +119,8 @@ PACK_STRUCT_END /** 5 seconds period */ #define ARP_TMR_INTERVAL 5000 -#define ETHTYPE_ARP 0x0806 -#define ETHTYPE_IP 0x0800 +#define ETHTYPE_ARP 0x0806 +#define ETHTYPE_IP 0x0800 #define ETHTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */ #define ETHTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */ diff --git a/src/netif/ethernetif.c b/src/netif/ethernetif.c index db45767e..d6cdbd22 100644 --- a/src/netif/ethernetif.c +++ b/src/netif/ethernetif.c @@ -288,14 +288,14 @@ ethernetif_input(struct netif *netif) #endif /* ETHARP_TCPIP_INPUT */ #endif /* ETHARP_TCPIP_ETHINPUT */ -#if PPPOE_SUPPORT > 0 +#if PPPOE_SUPPORT case ETHTYPE_PPPOEDISC: /* PPP Over Ethernet Discovery Stage */ - pppoe_disc_input(netif, p); - break; + pppoe_disc_input(netif, p); + break; case ETHTYPE_PPPOE: /* PPP Over Ethernet Session Stage */ - pppoe_data_input(netif, p); - break; -#endif + pppoe_data_input(netif, p); + break; +#endif /* PPPOE_SUPPORT */ default: pbuf_free(p);