Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Simplify the code by only checking for total_len...



details:   https://anonhg.NetBSD.org/src/rev/3c64c6671295
branches:  trunk
changeset: 784342:3c64c6671295
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Jan 26 07:52:16 2013 +0000

description:
Simplify the code by only checking for total_len < pktlen once. The second
check was actually wrong - found by matt@ and clang.

diffstat:

 sys/dev/usb/if_smsc.c |  8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diffs (22 lines):

diff -r 7c9c0ab94629 -r 3c64c6671295 sys/dev/usb/if_smsc.c
--- a/sys/dev/usb/if_smsc.c     Sat Jan 26 07:49:11 2013 +0000
+++ b/sys/dev/usb/if_smsc.c     Sat Jan 26 07:52:16 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_smsc.c,v 1.6 2013/01/22 12:40:43 jmcneill Exp $     */
+/*     $NetBSD: if_smsc.c,v 1.7 2013/01/26 07:52:16 skrll Exp $        */
 
 /*     $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1295,11 +1295,7 @@
                }
 
                buf += sizeof(rxhdr);
-
-               if ((total_len - pktlen) < 0)
-                       total_len = 0;
-               else
-                       total_len -= pktlen;
+               total_len -= pktlen;
 
                m = smsc_newbuf();
                if (m == NULL) {



Home | Main Index | Thread Index | Old Index