diff options
author | Alex Elder <elder@linaro.org> | 2021-06-11 22:05:25 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-11 23:37:49 +0300 |
commit | 874a333f7472b2cb57d8528cb26089858ca91005 (patch) | |
tree | 229f3ee8f8b584143ce2337f9eae1fe8b8485778 /drivers | |
parent | 1d257f45ef66796526425afc7d0a9d4dbf57fbb9 (diff) | |
download | linux-874a333f7472b2cb57d8528cb26089858ca91005.tar.xz |
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: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index ca07b87d7ed7..79f1d516b5cc 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -19,23 +19,13 @@ static __sum16 *rmnet_map_get_csum_field(unsigned char protocol, const void *txporthdr) { - __sum16 *check = NULL; + if (protocol == IPPROTO_TCP) + return &((struct tcphdr *)txporthdr)->check; - switch (protocol) { - case IPPROTO_TCP: - check = &(((struct tcphdr *)txporthdr)->check); - break; - - case IPPROTO_UDP: - check = &(((struct udphdr *)txporthdr)->check); - break; - - default: - check = NULL; - break; - } + if (protocol == IPPROTO_UDP) + return &((struct udphdr *)txporthdr)->check; - return check; + return NULL; } static int |