All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Petko Manolov <petkan@nucleusys.com>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Heinrich Schuchardt <xypron.glpk@gmx.de>
Subject: [PATCH 1/1] net: pegasus: remove dead coding
Date: Wed, 18 May 2016 02:13:30 +0200	[thread overview]
Message-ID: <1463530410-12772-1-git-send-email-xypron.glpk@gmx.de> (raw)

(!count || count < 4) is always true.
So let's remove the coding which is dead at least since 2005.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/net/usb/pegasus.c | 53 -----------------------------------------------
 1 file changed, 53 deletions(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 36cd7f0..1903d2e 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -470,61 +470,8 @@ static void read_bulk_callback(struct urb *urb)
 		return;
 	default:
 		netif_dbg(pegasus, rx_err, net, "RX status %d\n", status);
-		goto goon;
 	}
 
-	if (!count || count < 4)
-		goto goon;
-
-	rx_status = buf[count - 2];
-	if (rx_status & 0x1e) {
-		netif_dbg(pegasus, rx_err, net,
-			  "RX packet error %x\n", rx_status);
-		pegasus->stats.rx_errors++;
-		if (rx_status & 0x06)	/* long or runt	*/
-			pegasus->stats.rx_length_errors++;
-		if (rx_status & 0x08)
-			pegasus->stats.rx_crc_errors++;
-		if (rx_status & 0x10)	/* extra bits	*/
-			pegasus->stats.rx_frame_errors++;
-		goto goon;
-	}
-	if (pegasus->chip == 0x8513) {
-		pkt_len = le32_to_cpu(*(__le32 *)urb->transfer_buffer);
-		pkt_len &= 0x0fff;
-		pegasus->rx_skb->data += 2;
-	} else {
-		pkt_len = buf[count - 3] << 8;
-		pkt_len += buf[count - 4];
-		pkt_len &= 0xfff;
-		pkt_len -= 4;
-	}
-
-	/*
-	 * If the packet is unreasonably long, quietly drop it rather than
-	 * kernel panicing by calling skb_put.
-	 */
-	if (pkt_len > PEGASUS_MTU)
-		goto goon;
-
-	/*
-	 * at this point we are sure pegasus->rx_skb != NULL
-	 * so we go ahead and pass up the packet.
-	 */
-	skb_put(pegasus->rx_skb, pkt_len);
-	pegasus->rx_skb->protocol = eth_type_trans(pegasus->rx_skb, net);
-	netif_rx(pegasus->rx_skb);
-	pegasus->stats.rx_packets++;
-	pegasus->stats.rx_bytes += pkt_len;
-
-	if (pegasus->flags & PEGASUS_UNPLUG)
-		return;
-
-	pegasus->rx_skb = __netdev_alloc_skb_ip_align(pegasus->net, PEGASUS_MTU,
-						      GFP_ATOMIC);
-
-	if (pegasus->rx_skb == NULL)
-		goto tl_sched;
 goon:
 	usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
 			  usb_rcvbulkpipe(pegasus->usb, 1),
-- 
2.1.4

WARNING: multiple messages have this Message-ID (diff)
From: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
To: Petko Manolov <petkan-nPnTwAqkgEqakBO8gow8eQ@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
Subject: [PATCH 1/1] net: pegasus: remove dead coding
Date: Wed, 18 May 2016 02:13:30 +0200	[thread overview]
Message-ID: <1463530410-12772-1-git-send-email-xypron.glpk@gmx.de> (raw)

(!count || count < 4) is always true.
So let's remove the coding which is dead at least since 2005.

Signed-off-by: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
---
 drivers/net/usb/pegasus.c | 53 -----------------------------------------------
 1 file changed, 53 deletions(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 36cd7f0..1903d2e 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -470,61 +470,8 @@ static void read_bulk_callback(struct urb *urb)
 		return;
 	default:
 		netif_dbg(pegasus, rx_err, net, "RX status %d\n", status);
-		goto goon;
 	}
 
-	if (!count || count < 4)
-		goto goon;
-
-	rx_status = buf[count - 2];
-	if (rx_status & 0x1e) {
-		netif_dbg(pegasus, rx_err, net,
-			  "RX packet error %x\n", rx_status);
-		pegasus->stats.rx_errors++;
-		if (rx_status & 0x06)	/* long or runt	*/
-			pegasus->stats.rx_length_errors++;
-		if (rx_status & 0x08)
-			pegasus->stats.rx_crc_errors++;
-		if (rx_status & 0x10)	/* extra bits	*/
-			pegasus->stats.rx_frame_errors++;
-		goto goon;
-	}
-	if (pegasus->chip == 0x8513) {
-		pkt_len = le32_to_cpu(*(__le32 *)urb->transfer_buffer);
-		pkt_len &= 0x0fff;
-		pegasus->rx_skb->data += 2;
-	} else {
-		pkt_len = buf[count - 3] << 8;
-		pkt_len += buf[count - 4];
-		pkt_len &= 0xfff;
-		pkt_len -= 4;
-	}
-
-	/*
-	 * If the packet is unreasonably long, quietly drop it rather than
-	 * kernel panicing by calling skb_put.
-	 */
-	if (pkt_len > PEGASUS_MTU)
-		goto goon;
-
-	/*
-	 * at this point we are sure pegasus->rx_skb != NULL
-	 * so we go ahead and pass up the packet.
-	 */
-	skb_put(pegasus->rx_skb, pkt_len);
-	pegasus->rx_skb->protocol = eth_type_trans(pegasus->rx_skb, net);
-	netif_rx(pegasus->rx_skb);
-	pegasus->stats.rx_packets++;
-	pegasus->stats.rx_bytes += pkt_len;
-
-	if (pegasus->flags & PEGASUS_UNPLUG)
-		return;
-
-	pegasus->rx_skb = __netdev_alloc_skb_ip_align(pegasus->net, PEGASUS_MTU,
-						      GFP_ATOMIC);

             reply	other threads:[~2016-05-18  0:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18  0:13 Heinrich Schuchardt [this message]
2016-05-18  0:13 ` [PATCH 1/1] net: pegasus: remove dead coding Heinrich Schuchardt
2016-05-18  6:25 ` Petko Manolov
2016-05-18  6:30 ` [1/1] " Guenter Roeck
2016-05-18  7:15   ` Oliver Neukum
2016-05-18  7:50     ` Petko Manolov
2016-05-18 18:40     ` [PATCH 1/1] net: pegasus: simplify logical constraint Heinrich Schuchardt
2016-05-19  5:57       ` Petko Manolov
2016-05-23 20:49       ` David Miller
2016-05-19 18:35 ` [PATCH 1/1] net: pegasus: remove dead coding David Miller
2016-05-20  7:33   ` Petko Manolov
2016-05-20 16:38     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463530410-12772-1-git-send-email-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petkan@nucleusys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.