Skip to content

Commit

Permalink
can: Delete unnecessary checks before the macro call “dev_kfree_skb”
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Markus Elfring authored and David S. Miller committed Aug 22, 2019
1 parent 0f817a5 commit 038dab7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions drivers/net/can/spi/hi311x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/can/spi/mcp251x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 038dab7

Please sign in to comment.