Module Name:    src
Committed By:   christos
Date:           Sat Jan 19 20:49:33 UTC 2013

Modified Files:
        src/sys/dev/usb: usb_mem.c

Log Message:
avoid double assignment


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/usb/usb_mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.57 src/sys/dev/usb/usb_mem.c:1.58
--- src/sys/dev/usb/usb_mem.c:1.57	Sat Jan 19 15:49:06 2013
+++ src/sys/dev/usb/usb_mem.c	Sat Jan 19 15:49:33 2013
@@ -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 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 	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) {

Reply via email to