net/net.c: cosmetic: fix brace issues
This removes the following checkpatch issues: - WARNING: braces {} are not necessary for single statement blocks - WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
parent
4f63acd062
commit
d3c65b015a
38
net/net.c
38
net/net.c
@ -367,9 +367,8 @@ NetLoop(proto_t protocol)
|
|||||||
*/
|
*/
|
||||||
NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
|
NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
|
||||||
NetTxPacket -= (ulong)NetTxPacket % PKTALIGN;
|
NetTxPacket -= (ulong)NetTxPacket % PKTALIGN;
|
||||||
for (i = 0; i < PKTBUFSRX; i++) {
|
for (i = 0; i < PKTBUFSRX; i++)
|
||||||
NetRxPackets[i] = NetTxPacket + (i+1)*PKTSIZE_ALIGN;
|
NetRxPackets[i] = NetTxPacket + (i+1)*PKTSIZE_ALIGN;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NetArpWaitTxPacket) {
|
if (!NetArpWaitTxPacket) {
|
||||||
@ -491,11 +490,10 @@ restart:
|
|||||||
/*
|
/*
|
||||||
* Echo the inverted link state to the fault LED.
|
* Echo the inverted link state to the fault LED.
|
||||||
*/
|
*/
|
||||||
if (miiphy_link(eth_get_dev()->name, CONFIG_SYS_FAULT_MII_ADDR)) {
|
if (miiphy_link(eth_get_dev()->name, CONFIG_SYS_FAULT_MII_ADDR))
|
||||||
status_led_set(STATUS_LED_RED, STATUS_LED_OFF);
|
status_led_set(STATUS_LED_RED, STATUS_LED_OFF);
|
||||||
} else {
|
else
|
||||||
status_led_set(STATUS_LED_RED, STATUS_LED_ON);
|
status_led_set(STATUS_LED_RED, STATUS_LED_ON);
|
||||||
}
|
|
||||||
#endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */
|
#endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */
|
||||||
#endif /* CONFIG_MII, ... */
|
#endif /* CONFIG_MII, ... */
|
||||||
|
|
||||||
@ -1095,9 +1093,8 @@ CDPHandler(const uchar * pkt, unsigned len)
|
|||||||
ss = (const ushort *)pkt;
|
ss = (const ushort *)pkt;
|
||||||
type = ntohs(ss[0]);
|
type = ntohs(ss[0]);
|
||||||
tlen = ntohs(ss[1]);
|
tlen = ntohs(ss[1]);
|
||||||
if (tlen > len) {
|
if (tlen > len)
|
||||||
goto pkt_short;
|
goto pkt_short;
|
||||||
}
|
|
||||||
|
|
||||||
pkt += tlen;
|
pkt += tlen;
|
||||||
len -= tlen;
|
len -= tlen;
|
||||||
@ -1477,26 +1474,20 @@ NetReceive(volatile uchar * inpkt, int len)
|
|||||||
printf("bad length %d < %d\n", len, ARP_HDR_SIZE);
|
printf("bad length %d < %d\n", len, ARP_HDR_SIZE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ntohs(arp->ar_hrd) != ARP_ETHER) {
|
if (ntohs(arp->ar_hrd) != ARP_ETHER)
|
||||||
return;
|
return;
|
||||||
}
|
if (ntohs(arp->ar_pro) != PROT_IP)
|
||||||
if (ntohs(arp->ar_pro) != PROT_IP) {
|
|
||||||
return;
|
return;
|
||||||
}
|
if (arp->ar_hln != 6)
|
||||||
if (arp->ar_hln != 6) {
|
|
||||||
return;
|
return;
|
||||||
}
|
if (arp->ar_pln != 4)
|
||||||
if (arp->ar_pln != 4) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (NetOurIP == 0) {
|
if (NetOurIP == 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (NetReadIP(&arp->ar_data[16]) != NetOurIP) {
|
if (NetReadIP(&arp->ar_data[16]) != NetOurIP)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
switch (ntohs(arp->ar_op)) {
|
switch (ntohs(arp->ar_op)) {
|
||||||
case ARPOP_REQUEST:
|
case ARPOP_REQUEST:
|
||||||
@ -1601,13 +1592,11 @@ NetReceive(volatile uchar * inpkt, int len)
|
|||||||
debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
|
debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
|
||||||
|
|
||||||
/* Can't deal with anything except IPv4 */
|
/* Can't deal with anything except IPv4 */
|
||||||
if ((ip->ip_hl_v & 0xf0) != 0x40) {
|
if ((ip->ip_hl_v & 0xf0) != 0x40)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
/* Can't deal with IP options (headers != 20 bytes) */
|
/* Can't deal with IP options (headers != 20 bytes) */
|
||||||
if ((ip->ip_hl_v & 0x0f) > 0x05) {
|
if ((ip->ip_hl_v & 0x0f) > 0x05)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
/* Check the Checksum of the header */
|
/* Check the Checksum of the header */
|
||||||
if (!NetCksumOk((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2)) {
|
if (!NetCksumOk((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2)) {
|
||||||
puts("checksum bad\n");
|
puts("checksum bad\n");
|
||||||
@ -1950,9 +1939,8 @@ void copy_filename(char *dst, const char *src, int size)
|
|||||||
--size;
|
--size;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((--size > 0) && *src && (*src != '"')) {
|
while ((--size > 0) && *src && (*src != '"'))
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
}
|
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user