Skip to contentSkip to conversation

ems_usb: cleanup: remove uneeded check

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 6, 2010 – Mar 7, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ems_usb: cleanup: remove uneeded check

"skb" is alway non-null here, but even if it were null the check isn't needed because dev_kfree_skb() can handle it.

This eliminates a smatch warning about dereferencing a variable before checking that it is non-null.

drivers/net/can/usb/ems_usb.c +1 -3
index 11c8784..3345109 100644
@@ -876,9 +876,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
 	return NETDEV_TX_OK;
 
 nomem:
-	if (skb)
-		dev_kfree_skb(skb);
-
+	dev_kfree_skb(skb);
 	stats->tx_dropped++;
 
 	return NETDEV_TX_OK;
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Sat, 6 Mar 2010 14:11:38 +0300

Quoted 7 lines

"skb" is alway non-null here, but even if it were null the check isn't needed because dev_kfree_skb() can handle it.

This eliminates a smatch warning about dereferencing a variable before checking that it is non-null.

Applied.