Staging: gdm724x: Remove unnecessary cast on void pointer
authorShraddha Barke <shraddha.6596@gmail.com>
Wed, 14 Oct 2015 19:28:20 +0000 (00:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Oct 2015 05:51:48 +0000 (22:51 -0700)
void pointers do not need to be cast to other pointer types.

Semantic patch:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm724x/gdm_lte.c
drivers/staging/gdm724x/gdm_mux.c
drivers/staging/gdm724x/gdm_tty.c
drivers/staging/gdm724x/gdm_usb.c

index a8d2cffb411cb8bf7460dfb2b6537343ba10e37c..8a55ec1e5331264951e6ca665524239bdcda1960 100644 (file)
@@ -377,11 +377,11 @@ static s32 gdm_lte_tx_nic_type(struct net_device *dev, struct sk_buff *skb)
                break;
        case ETH_P_IP:
                nic_type |= NIC_TYPE_F_IPV4;
-               ip = (struct iphdr *)network_data;
+               ip = network_data;
 
                /* Check DHCPv4 */
                if (ip->protocol == IPPROTO_UDP) {
-                       struct udphdr *udp = (struct udphdr *)
+                       struct udphdr *udp =
                                        (network_data + sizeof(struct iphdr));
                        if (ntohs(udp->dest) == 67 || ntohs(udp->dest) == 68)
                                nic_type |= NIC_TYPE_F_DHCP;
@@ -389,15 +389,15 @@ static s32 gdm_lte_tx_nic_type(struct net_device *dev, struct sk_buff *skb)
                break;
        case ETH_P_IPV6:
                nic_type |= NIC_TYPE_F_IPV6;
-               ipv6 = (struct ipv6hdr *)network_data;
+               ipv6 = network_data;
 
                if (ipv6->nexthdr == IPPROTO_ICMPV6) /* Check NDP request */ {
-                       struct icmp6hdr *icmp6 = (struct icmp6hdr *)
+                       struct icmp6hdr *icmp6 =
                                        (network_data + sizeof(struct ipv6hdr));
                        if (icmp6->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION)
                                nic_type |= NIC_TYPE_ICMPV6;
                } else if (ipv6->nexthdr == IPPROTO_UDP) /* Check DHCPv6 */ {
-                       struct udphdr *udp = (struct udphdr *)
+                       struct udphdr *udp =
                                        (network_data + sizeof(struct ipv6hdr));
                        if (ntohs(udp->dest) == 546 || ntohs(udp->dest) == 547)
                                nic_type |= NIC_TYPE_F_DHCP;
@@ -814,9 +814,9 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, char *buf, int len)
 
 static int rx_complete(void *arg, void *data, int len, int context)
 {
-       struct phy_dev *phy_dev = (struct phy_dev *)arg;
+       struct phy_dev *phy_dev = arg;
 
-       return gdm_lte_receive_pkt(phy_dev, (char *)data, len);
+       return gdm_lte_receive_pkt(phy_dev, data, len);
 }
 
 void start_rx_proc(struct phy_dev *phy_dev)
index 1cf24e4edf251ca1896a72073c5fdf6df0eac336..97b72a0b4ab71a026dd541c74b8315967b008307 100644 (file)
@@ -153,7 +153,7 @@ static void put_rx_struct(struct rx_cxt *rx, struct mux_rx *r)
 
 static int up_to_host(struct mux_rx *r)
 {
-       struct mux_dev *mux_dev = (struct mux_dev *)r->mux_dev;
+       struct mux_dev *mux_dev = r->mux_dev;
        struct mux_pkt_header *mux_header;
        unsigned int start_flag;
        unsigned int payload_size;
@@ -262,7 +262,7 @@ static void remove_rx_submit_list(struct mux_rx *r, struct rx_cxt *rx)
 static void gdm_mux_rcv_complete(struct urb *urb)
 {
        struct mux_rx *r = urb->context;
-       struct mux_dev *mux_dev = (struct mux_dev *)r->mux_dev;
+       struct mux_dev *mux_dev = r->mux_dev;
        struct rx_cxt *rx = &mux_dev->rx;
        unsigned long flags;
 
index 001348ccacf95cacd3cca7829681089314a36e1c..655f7688d03925a4796ff194298c922e89ae920b 100644 (file)
@@ -167,7 +167,7 @@ static int gdm_tty_recv_complete(void *data,
 
 static void gdm_tty_send_complete(void *arg)
 {
-       struct gdm *gdm = (struct gdm *)arg;
+       struct gdm *gdm = arg;
 
        if (!GDM_TTY_READY(gdm))
                return;
index ed1a12f504e2183e459bc3e43e171255caaf9c38..9ceba147d390b8e8db99078f673b844ec87590da 100644 (file)
@@ -367,7 +367,7 @@ fail:
 
 static int set_mac_address(u8 *data, void *arg)
 {
-       struct phy_dev *phy_dev = (struct phy_dev *)arg;
+       struct phy_dev *phy_dev = arg;
        struct lte_udev *udev = phy_dev->priv_dev;
        struct tlv *tlv = (struct tlv *)data;
        u8 mac_address[ETH_ALEN] = {0, };
@@ -410,8 +410,8 @@ static void do_rx(struct work_struct *work)
                list_del(&r->to_host_list);
                spin_unlock_irqrestore(&rx->to_host_lock, flags);
 
-               phy_dev = (struct phy_dev *)r->cb_data;
-               udev = (struct lte_udev *)phy_dev->priv_dev;
+               phy_dev = r->cb_data;
+               udev = phy_dev->priv_dev;
                hci = (struct hci_packet *)r->buf;
                cmd_evt = gdm_dev16_to_cpu(&udev->gdm_ed, hci->cmd_evt);