lwip: fix code style issues

Fix various code style issues in the lwIP code.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/net/lwip/eth_internal.h b/net/lwip/eth_internal.h
index 0b829a8..87561d5 100644
--- a/net/lwip/eth_internal.h
+++ b/net/lwip/eth_internal.h
@@ -25,7 +25,7 @@
  * Return: 0 if OK, other value on error
  */
 int eth_env_set_enetaddr_by_index(const char *base_name, int index,
-				 uchar *enetaddr);
+				  uchar *enetaddr);
 
 int eth_mac_skip(int index);
 void eth_current_changed(void);
diff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c
index 5c2bb2e..4702177 100644
--- a/net/lwip/net-lwip.c
+++ b/net/lwip/net-lwip.c
@@ -203,7 +203,6 @@
 
 struct netif *net_lwip_new_netif_noip(struct udevice *udev)
 {
-
 	return new_netif(udev, false);
 }
 
@@ -224,24 +223,24 @@
 
 static struct pbuf *alloc_pbuf_and_copy(uchar *data, int len)
 {
-        struct pbuf *p, *q;
+	struct pbuf *p, *q;
 
-        /* We allocate a pbuf chain of pbufs from the pool. */
-        p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
-        if (!p) {
-                LINK_STATS_INC(link.memerr);
-                LINK_STATS_INC(link.drop);
-                return NULL;
-        }
+	/* We allocate a pbuf chain of pbufs from the pool. */
+	p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
+	if (!p) {
+		LINK_STATS_INC(link.memerr);
+		LINK_STATS_INC(link.drop);
+		return NULL;
+	}
 
-        for (q = p; q != NULL; q = q->next) {
-                memcpy(q->payload, data, q->len);
-                data += q->len;
-        }
+	for (q = p; q != NULL; q = q->next) {
+		memcpy(q->payload, data, q->len);
+		data += q->len;
+	}
 
-        LINK_STATS_INC(link.recv);
+	LINK_STATS_INC(link.recv);
 
-        return p;
+	return p;
 }
 
 int net_lwip_rx(struct udevice *udev, struct netif *netif)
diff --git a/net/lwip/ping.c b/net/lwip/ping.c
index 8dafa25..aa61753 100644
--- a/net/lwip/ping.c
+++ b/net/lwip/ping.c
@@ -39,8 +39,8 @@
 	    pbuf_remove_header(p, IP_HLEN) == 0) {
 		iecho = (struct icmp_echo_hdr *)p->payload;
 
-		if ((iecho->id == PING_ID) &&
-		    (iecho->seqno == lwip_htons(ctx->seq_num))) {
+		if (iecho->id == PING_ID &&
+		    iecho->seqno == lwip_htons(ctx->seq_num)) {
 			ctx->alive = true;
 			printf("host %s is alive\n", ipaddr_ntoa(addr));
 			pbuf_free(p);
@@ -93,7 +93,7 @@
 	if (!p)
 		return;
 
-	if ((p->len == p->tot_len) && !p->next) {
+	if (p->len == p->tot_len && !p->next) {
 		ctx->iecho = (struct icmp_echo_hdr *)p->payload;
 		ping_prepare_echo(ctx);
 		raw_sendto(ctx->pcb, p, &ctx->target);
@@ -113,7 +113,7 @@
 	}
 }
 
-static int ping_loop(struct udevice *udev, const ip_addr_t* addr)
+static int ping_loop(struct udevice *udev, const ip_addr_t *addr)
 {
 	struct ping_ctx ctx = {};
 	struct netif *netif;
diff --git a/net/lwip/tftp.c b/net/lwip/tftp.c
index f4d0a6a..fc4aff5 100644
--- a/net/lwip/tftp.c
+++ b/net/lwip/tftp.c
@@ -71,7 +71,7 @@
 	struct tftp_ctx *ctx = handle;
 	struct pbuf *q;
 
-	for (q = p; q != NULL; q = q->next) {
+	for (q = p; q; q = q->next) {
 		memcpy((void *)ctx->daddr, q->payload, q->len);
 		ctx->daddr += q->len;
 		ctx->size += q->len;
@@ -130,7 +130,7 @@
 
 	printf("Using %s device\n", udev->name);
 	printf("TFTP from server %s; our IP address is %s\n",
-		 ip4addr_ntoa(&srvip), env_get("ipaddr"));
+	       ip4addr_ntoa(&srvip), env_get("ipaddr"));
 	printf("Filename '%s'.\n", fname);
 	printf("Load address: 0x%lx\n", ctx.daddr);
 	printf("Loading: ");
@@ -187,7 +187,7 @@
 	char *server_port = NULL;
 	char *end;
 	ip_addr_t srvip;
-	uint16_t port = TFTP_PORT;
+	u16 port = TFTP_PORT;
 	ulong laddr;
 	ulong addr;
 	int i;
@@ -228,7 +228,7 @@
 	if (arg) {
 		/* Parse [ip:[port:]]fname */
 		i = 0;
-		while ((*(words + i) = strsep(&arg,":")))
+		while ((*(words + i) = strsep(&arg, ":")))
 			i++;
 
 		switch (i) {
diff --git a/net/lwip/wget.c b/net/lwip/wget.c
index ba85798..26086ed 100644
--- a/net/lwip/wget.c
+++ b/net/lwip/wget.c
@@ -21,9 +21,9 @@
 #define PROGRESS_PRINT_STEP_BYTES (100 * 1024)
 
 enum done_state {
-        NOT_DONE = 0,
-        SUCCESS = 1,
-        FAILURE = 2
+	NOT_DONE = 0,
+	SUCCESS = 1,
+	FAILURE = 2
 };
 
 struct wget_ctx {
@@ -163,7 +163,7 @@
 
 	if (rem < n)
 		return -1;
-	strncpy(p, server, n);
+	strlcpy(p, server, n);
 	p += n;
 	rem -= n;
 	if (rem < 1)
@@ -174,7 +174,7 @@
 	n = strlen(path);
 	if (rem < n)
 		return -1;
-	strncpy(p, path, n);
+	strlcpy(p, path, n);
 	p += n;
 	rem -= n;
 	if (rem < 1)
@@ -334,7 +334,7 @@
 		return CMD_RET_USAGE;
 
 	dst_addr = hextoul(argv[1], &end);
-        if (end == (argv[1] + strlen(argv[1]))) {
+	if (end == (argv[1] + strlen(argv[1]))) {
 		if (argc < 3)
 			return CMD_RET_USAGE;
 		url = argv[2];
@@ -344,7 +344,7 @@
 	}
 
 	if (parse_legacy_arg(url, nurl, sizeof(nurl)))
-	    return CMD_RET_FAILURE;
+		return CMD_RET_FAILURE;
 
 	if (wget_with_dns(dst_addr, nurl))
 		return CMD_RET_FAILURE;