diff mbox

6lowpan: Combine two condition checks into one statement in lowpan_xmit()

Message ID 221426d9-d049-b304-d7c1-bdf0a788bf36@users.sourceforge.net (mailing list archive)
State Not Applicable
Headers show

Commit Message

SF Markus Elfring Nov. 8, 2017, 9:20 a.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Nov 2017 10:10:41 +0100

The same exception handling was used in an if branch of two
separate statements.

* Merge their condition checks into a single statement instead.

* Delete the local variable "ret" which became unnecessary
  with this refactoring.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/ieee802154/6lowpan/tx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/net/ieee802154/6lowpan/tx.c b/net/ieee802154/6lowpan/tx.c
index e6ff5128e61a..1b0757db2078 100644
--- a/net/ieee802154/6lowpan/tx.c
+++ b/net/ieee802154/6lowpan/tx.c
@@ -255,7 +255,7 @@  static int lowpan_header(struct sk_buff *skb, struct net_device *ldev,
 netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
 {
 	struct ieee802154_hdr wpan_hdr;
-	int max_single, ret;
+	int max_single;
 	u16 dgram_size, dgram_offset;
 
 	pr_debug("package xmit\n");
@@ -269,13 +269,8 @@  netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
 	if (!skb)
 		return NET_XMIT_DROP;
 
-	ret = lowpan_header(skb, ldev, &dgram_size, &dgram_offset);
-	if (ret < 0) {
-		kfree_skb(skb);
-		return NET_XMIT_DROP;
-	}
-
-	if (ieee802154_hdr_peek(skb, &wpan_hdr) < 0) {
+	if (lowpan_header(skb, ldev, &dgram_size, &dgram_offset) < 0 ||
+	    ieee802154_hdr_peek(skb, &wpan_hdr) < 0) {
 		kfree_skb(skb);
 		return NET_XMIT_DROP;
 	}