Source-Changes-HG archive

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

[src/nick-nhusb]: src/sys/dev/usb Fix malloc to kmem conversion by grabbing n...



details:   https://anonhg.NetBSD.org/src/rev/28aa07399adb
branches:  nick-nhusb
changeset: 804291:28aa07399adb
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Mar 11 07:48:42 2015 +0000

description:
Fix malloc to kmem conversion by grabbing nendpt before calling
usbd_fill_iface_data

diffstat:

 sys/dev/usb/usbdi.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 71fac9b702cd -r 28aa07399adb sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Tue Mar 10 06:40:56 2015 +0000
+++ b/sys/dev/usb/usbdi.c       Wed Mar 11 07:48:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.162.2.18 2015/03/06 14:08:39 skrll Exp $   */
+/*     $NetBSD: usbdi.c,v 1.162.2.19 2015/03/11 07:48:42 skrll Exp $   */
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.18 2015/03/06 14:08:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.19 2015/03/11 07:48:42 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -748,13 +748,13 @@
                return USBD_IN_USE;
 
        endpoints = iface->ui_endpoints;
+       int nendpt = iface->ui_idesc->bNumEndpoints;
        err = usbd_fill_iface_data(iface->ui_dev, iface->ui_index, altidx);
        if (err)
                return err;
 
        /* new setting works, we can free old endpoints */
        if (endpoints != NULL) {
-               int nendpt = iface->ui_idesc->bNumEndpoints;
                kmem_free(endpoints, nendpt * sizeof(struct usbd_endpoint));
        }
 



Home | Main Index | Thread Index | Old Index