summaryrefslogtreecommitdiff
path: root/drivers/staging/gdm724x
diff options
context:
space:
mode:
authorJavier Rodriguez <jrodbar@yahoo.es>2017-02-14 18:16:22 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-06 09:16:58 +0100
commitefe96779e55eb59c1d22c9b89b655b639aea6c99 (patch)
tree09a08f58a8a14fa22d5ea556f2228e757f0c6a98 /drivers/staging/gdm724x
parent607b6cd3d083ae1deaf93ff2634abe147459c9bc (diff)
staging: gdm724x: modify icmp6_checksum for returning a correct data type.
The icmp6_checksum was returning an invalid data type as the expected type is __sum16. For returning such data type, icmp6_checksum, now, is using the kernel functions for computing the checksum. Here, the sparse message: drivers/staging/gdm724x/gdm_lte.c:311:39: warning: incorrect type in assignment (different base types) drivers/staging/gdm724x/gdm_lte.c:311:39: expected restricted __sum16 [addressable] [assigned] [usertype] icmp6_cksum drivers/staging/gdm724x/gdm_lte.c:311:39: got int Signed-off-by: Javier Rodriguez <jrodbar@yahoo.es> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gdm724x')
-rw-r--r--drivers/staging/gdm724x/gdm_lte.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c
index a3e046c3f65c..904be6a2f1fb 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -178,10 +178,10 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, u32 nic_type)
return 0;
}
-static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len)
+static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len)
{
unsigned short *w = ptr;
- int sum = 0;
+ __wsum sum = 0;
int i;
union {
@@ -203,19 +203,16 @@ static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len)
w = (u16 *)&pseudo_header;
for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++)
- sum += pseudo_header.pa[i];
+ sum = csum_add(sum, csum_unfold(
+ (__force __sum16)pseudo_header.pa[i]));
w = ptr;
while (len > 1) {
- sum += *w++;
+ sum = csum_add(sum, csum_unfold((__force __sum16)*w++));
len -= 2;
}
- sum = (sum >> 16) + (sum & 0xFFFF);
- sum += (sum >> 16);
- sum = ~sum & 0xffff;
-
- return sum;
+ return csum_fold(sum);
}
static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type)