Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb avoid double assignment



details:   https://anonhg.NetBSD.org/src/rev/a28050b5fea2
branches:  trunk
changeset: 784149:a28050b5fea2
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 19 20:49:33 2013 +0000

description:
avoid double assignment

diffstat:

 sys/dev/usb/usb_mem.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r a48c7042c0de -r a28050b5fea2 sys/dev/usb/usb_mem.c
--- a/sys/dev/usb/usb_mem.c     Sat Jan 19 20:49:06 2013 +0000
+++ b/sys/dev/usb/usb_mem.c     Sat Jan 19 20:49:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_mem.c,v 1.57 2013/01/19 20:49:06 christos Exp $    */
+/*     $NetBSD: usb_mem.c,v 1.58 2013/01/19 20:49:33 christos Exp $    */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.57 2013/01/19 20:49:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.58 2013/01/19 20:49:33 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -167,10 +167,11 @@
        b->size = size;
        b->align = align;
 
-       b->nsegs = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
        if (!multiseg)
                /* Caller wants one segment */
                b->nsegs = 1;
+       else
+               b->nsegs = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
 
        b->segs = kmem_alloc(b->nsegs * sizeof(*b->segs), KM_SLEEP);
        if (b->segs == NULL) {



Home | Main Index | Thread Index | Old Index