Commit 874a333f authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: qualcomm: rmnet: simplify rmnet_map_get_csum_field()

The checksum fields of the TCP and UDP header structures already
have type __sum16.  We don't support any other protocol headers, so
we can simplify rmnet_map_get_csum_field(), getting rid of the local
variable entirely and just returning the appropriate address.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1d257f45
...@@ -19,23 +19,13 @@ ...@@ -19,23 +19,13 @@
static __sum16 *rmnet_map_get_csum_field(unsigned char protocol, static __sum16 *rmnet_map_get_csum_field(unsigned char protocol,
const void *txporthdr) const void *txporthdr)
{ {
__sum16 *check = NULL; if (protocol == IPPROTO_TCP)
return &((struct tcphdr *)txporthdr)->check;
switch (protocol) { if (protocol == IPPROTO_UDP)
case IPPROTO_TCP: return &((struct udphdr *)txporthdr)->check;
check = &(((struct tcphdr *)txporthdr)->check);
break;
case IPPROTO_UDP:
check = &(((struct udphdr *)txporthdr)->check);
break;
default: return NULL;
check = NULL;
break;
}
return check;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment