staging: gdm724x: fix return codes in gdm_lte
authorAndrii Vladyka <tulup@mail.ru>
Wed, 18 Oct 2017 13:23:45 +0000 (16:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Oct 2017 12:42:50 +0000 (14:42 +0200)
fix return codes in gdm_lte in gdm724x driver

Signed-off-by: Andrii Vladyka <tulup@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm724x/gdm_lte.c

index 066b14e..0527b0d 100644 (file)
@@ -246,13 +246,13 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type)
        if (ntohs(((struct ethhdr *)skb_in->data)->h_proto) == ETH_P_8021Q) {
                memcpy(&vlan_eth, skb_in->data, sizeof(struct vlan_ethhdr));
                if (ntohs(vlan_eth.h_vlan_encapsulated_proto) != ETH_P_IPV6)
-                       return -1;
+                       return -EPROTONOSUPPORT;
                mac_header_data = &vlan_eth;
                mac_header_len = VLAN_ETH_HLEN;
        } else {
                memcpy(&eth, skb_in->data, sizeof(struct ethhdr));
                if (ntohs(eth.h_proto) != ETH_P_IPV6)
-                       return -1;
+                       return -EPROTONOSUPPORT;
                mac_header_data = &eth;
                mac_header_len = ETH_HLEN;
        }
@@ -260,13 +260,13 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type)
        /* Check if this is IPv6 ICMP packet */
        ipv6_in = (struct ipv6hdr *)(skb_in->data + mac_header_len);
        if (ipv6_in->version != 6 || ipv6_in->nexthdr != IPPROTO_ICMPV6)
-               return -1;
+               return -EPROTONOSUPPORT;
 
        /* Check if this is NDP packet */
        icmp6_in = (struct icmp6hdr *)(skb_in->data + mac_header_len +
                                        sizeof(struct ipv6hdr));
        if (icmp6_in->icmp6_type == NDISC_ROUTER_SOLICITATION) { /* Check RS */
-               return -1;
+               return -EPROTONOSUPPORT;
        } else if (icmp6_in->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
                /* Check NS */
                u8 icmp_na[sizeof(struct icmp6hdr) +
@@ -310,7 +310,7 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type)
                icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out,
                                        (u16 *)icmp_na, sizeof(icmp_na));
        } else {
-               return -1;
+               return -EINVAL;
        }
 
        /* Fill the destination mac with source mac of the received packet */
@@ -417,7 +417,7 @@ static int gdm_lte_tx(struct sk_buff *skb, struct net_device *dev)
        nic_type = gdm_lte_tx_nic_type(dev, skb);
        if (nic_type == 0) {
                netdev_err(dev, "tx - invalid nic_type\n");
-               return -1;
+               return -EMEDIUMTYPE;
        }
 
        if (nic_type & NIC_TYPE_ARP) {
@@ -544,7 +544,7 @@ int gdm_lte_event_init(void)
        }
 
        pr_err("event init failed\n");
-       return -1;
+       return -ENODATA;
 }
 
 void gdm_lte_event_exit(void)