caif: delete unnecessary field initialization
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 15 Feb 2014 07:36:13 +0000 (08:36 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Feb 2014 05:29:23 +0000 (00:29 -0500)
On success, the function netdev_alloc_skb initializes the dev field of its
result to its first argument, so this doesn't have to be done in the
calling context.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression skb,privn,e;
@@

skb = netdev_alloc_skb(privn,...);
... when strict
(
-skb->dev = privn;
|
?skb = e
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/caif/caif_serial.c
drivers/net/caif/caif_spi.c

index 88a6a5810ec6820a1e8f2b674021a4a142804885..fc73865bb83a705f9fa1d1f3d70e1c6191952b9b 100644 (file)
@@ -204,7 +204,6 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data,
 
        skb->protocol = htons(ETH_P_CAIF);
        skb_reset_mac_header(skb);
-       skb->dev = ser->dev;
        debugfs_rx(ser, data, count);
        /* Push received packet up the stack. */
        ret = netif_rx_ni(skb);
index 155db68e13bae83ce006d7835bdbc93d38cdd878..ff54c0eb2052137d8f1561448f3c654f34d354df 100644 (file)
@@ -554,7 +554,6 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len)
 
                skb->protocol = htons(ETH_P_CAIF);
                skb_reset_mac_header(skb);
-               skb->dev = cfspi->ndev;
 
                /*
                 * Push received packet up the stack.
This page took 0.047001 seconds and 5 git commands to generate.