checkpatch run on net/ethernet

5 messages, 2 authors, 2012-10-02 · open the first message on its own page

checkpatch run on net/ethernet

From: <hidden>
Date: 2012-10-02 11:41:57

This is my first patch, it's just a checkpatch run. I figured I would also clean up the code as there appears to be long-since-obsoleted comments and code in there.

A fairly trivial change, but worthy of inclusion IMO all the same!

Matthew Walster

[PATCH 1/2] net: ethernet: clean out braces / old code (found via checkpatch)

From: <hidden>
Date: 2012-10-02 11:42:07

From: Matthew Walster <redacted>

Remove an old commented out piece of code.
Remove an if(true) statement.
Remove a set of braces that weren't strictly necessary.

All found by running checkpatch.pl against the code.

Signed-off-by: Matthew Walster <redacted>
---
 net/ethernet/eth.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 4efad53..a9f8531 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -178,11 +178,8 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 	 *      seems to set IFF_PROMISC.
 	 */
 
-	else if (1 /*dev->flags&IFF_PROMISC */ ) {
-		if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
-						      dev->dev_addr)))
-			skb->pkt_type = PACKET_OTHERHOST;
-	}
+	else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, dev->dev_addr)))
+		skb->pkt_type = PACKET_OTHERHOST;
 
 	/*
 	 * Some variants of DSA tagging don't have an ethertype field
-- 
1.7.10.4

[PATCH 2/2] net: ethernet: Remove obsolete comment

From: <hidden>
Date: 2012-10-02 11:43:36

From: Matthew Walster <redacted>

The deleted comment was related to code I've just removed in the previous patch.
---
 net/ethernet/eth.c |    8 --------
 1 file changed, 8 deletions(-)
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index a9f8531..7d72108 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -170,14 +170,6 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 			skb->pkt_type = PACKET_MULTICAST;
 	}
 
-	/*
-	 *      This ALLMULTI check should be redundant by 1.4
-	 *      so don't forget to remove it.
-	 *
-	 *      Seems, you forgot to remove it. All silly devices
-	 *      seems to set IFF_PROMISC.
-	 */
-
 	else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, dev->dev_addr)))
 		skb->pkt_type = PACKET_OTHERHOST;
 
-- 
1.7.10.4

Re: [PATCH 1/2] net: ethernet: clean out braces / old code (found via checkpatch)

From: David Miller <davem@davemloft.net>
Date: 2012-10-02 18:46:07

From: matthew@walster.org
Date: Tue,  2 Oct 2012 12:41:44 +0100
From: Matthew Walster <redacted>

Remove an old commented out piece of code.
Remove an if(true) statement.
Remove a set of braces that weren't strictly necessary.

All found by running checkpatch.pl against the code.

Signed-off-by: Matthew Walster <redacted>
That comment and that unconditional if() are documentation.

Don't be an automaton and blindly make changes based upon
checkpatch.pl output.

Re: [PATCH 2/2] net: ethernet: Remove obsolete comment

From: David Miller <davem@davemloft.net>
Date: 2012-10-02 18:46:29

From: matthew@walster.org
Date: Tue,  2 Oct 2012 12:41:45 +0100
From: Matthew Walster <redacted>

The deleted comment was related to code I've just removed in the previous patch.
The first change was wrong and therefore this change is also useless.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help