can: Delete unnecessary checks before the macro call “dev_kfree_skb”
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 21 Aug 2019 19:16:15 +0000 (21:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Aug 2019 23:22:03 +0000 (16:22 -0700)
The dev_kfree_skb() function performs also input parameter validation.
Thus the test around the shown calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/can/spi/hi311x.c
drivers/net/can/spi/mcp251x.c

index 28badace720e0c1ff3597343f6f54ebe8808f6d6..73d48c3b8ded3a8365288d6f6e2f151e28dec7cf 100644 (file)
@@ -177,8 +177,7 @@ static void hi3110_clean(struct net_device *net)
 
        if (priv->tx_skb || priv->tx_len)
                net->stats.tx_errors++;
-       if (priv->tx_skb)
-               dev_kfree_skb(priv->tx_skb);
+       dev_kfree_skb(priv->tx_skb);
        if (priv->tx_len)
                can_free_echo_skb(priv->net, 0);
        priv->tx_skb = NULL;
index 05547dd36d61ad0d2f51aa1dcadfcca5d7353792..58992fd61cb93090ee0f56fe59ae4a537ebec078 100644 (file)
@@ -264,8 +264,7 @@ static void mcp251x_clean(struct net_device *net)
 
        if (priv->tx_skb || priv->tx_len)
                net->stats.tx_errors++;
-       if (priv->tx_skb)
-               dev_kfree_skb(priv->tx_skb);
+       dev_kfree_skb(priv->tx_skb);
        if (priv->tx_len)
                can_free_echo_skb(priv->net, 0);
        priv->tx_skb = NULL;