Skip to contentSkip to conversation

6lowpan: cleanup for lowpan_rcv

PATCH In review [email protected] 2 participants 3 messages Oct 7, 2014

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

PATCH 1/1 6lowpan: cleanup for lowpan_rcv

From: Varka Bhadram <[email protected]>

Instead of collecting the return value into 'ret' variable and checking the perticular return value specifically, this patch remove these by directly including function within 'if' statement

---
 net/ieee802154/6lowpan_rtnl.c |   21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
net/ieee802154/6lowpan_rtnl.c +6 -15
index c7e07b8..38772d4 100644
@@ -507,7 +507,6 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 		      struct packet_type *pt, struct net_device *orig_dev)
 {
 	struct ieee802154_hdr hdr;
-	int ret;
 
 	skb = skb_share_check(skb, GFP_ATOMIC);
 	if (!skb)
@@ -533,31 +532,23 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 		/* Pull off the 1-byte of 6lowpan header. */
 		skb_pull(skb, 1);
 
-		ret = lowpan_give_skb_to_devices(skb, NULL);
-		if (ret == NET_RX_DROP)
+		if (lowpan_give_skb_to_devices(skb, NULL))
 			goto drop;
 	} else {
 		switch (skb->data[0] & 0xe0) {
 		case LOWPAN_DISPATCH_IPHC:	/* ipv6 datagram */
-			ret = process_data(skb, &hdr);
-			if (ret == NET_RX_DROP)
+			if (process_data(skb, &hdr))
 				goto drop;
 			break;
 		case LOWPAN_DISPATCH_FRAG1:	/* first fragment header */
-			ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1);
-			if (ret == 1) {
-				ret = process_data(skb, &hdr);
-				if (ret == NET_RX_DROP)
+			if (lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1))
+				if (process_data(skb, &hdr))
 					goto drop;
-			}
 			break;
 		case LOWPAN_DISPATCH_FRAGN:	/* next fragments headers */
-			ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN);
-			if (ret == 1) {
-				ret = process_data(skb, &hdr);
-				if (ret == NET_RX_DROP)
+			if (lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN))
+				if (process_data(skb, &hdr))
 					goto drop;
-			}
 			break;
 		default:
 			break;
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

Hi Varka,

Quoted 6 lines · On Tue, Oct 07, 2014 at 09:24:15AM +0530, [email protected] wrote:

From: Varka Bhadram <[email protected]>

Instead of collecting the return value into 'ret' variable and checking the perticular return value specifically, this patch remove these by directly including function within 'if' statement

My opinion to this patch hasn't changed. The return value handling of these functions are current broken and Martin works on this. After Martin get his patches in you can do some cleanup here.

- Alex

#2 lore raw

Hi Alex,

Quoted 5 lines · Alexander Aring

Hi Varka,

Quoted 2 lines · On Tue, Oct 07, 2014 at 09:24:15AM +0530, [email protected] wrote:

From: Varka Bhadram <[email protected]>

Quoted 7 lines
Quoted 4 lines

Instead of collecting the return value into 'ret' variable and checking the perticular return value specifically, this patch remove these by directly including function within 'if' statement

My opinion to this patch hasn't changed. The return value handling of these functions are current broken and Martin works on this. After Martin get his patches in you can do some cleanup here.

Ok. Thanks...

Signature · 2 lines
Regards,
Varka Bhadram.