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 What was I thinking... usbd_free_xfer handl...



details:   https://anonhg.NetBSD.org/src/rev/af6d90fcc60a
branches:  nick-nhusb
changeset: 334131:af6d90fcc60a
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Mar 05 09:06:20 2015 +0000

description:
What was I thinking... usbd_free_xfer handles the buffer free.

Need more coffee

diffstat:

 sys/dev/usb/usbdi.c    |  15 +++++----------
 sys/dev/usb/usbdivar.h |   3 +--
 2 files changed, 6 insertions(+), 12 deletions(-)

diffs (88 lines):

diff -r 82fb4ed8dff3 -r af6d90fcc60a sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Thu Mar 05 08:48:07 2015 +0000
+++ b/sys/dev/usb/usbdi.c       Thu Mar 05 09:06:20 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.162.2.12 2015/03/05 08:48:07 skrll Exp $   */
+/*     $NetBSD: usbdi.c,v 1.162.2.13 2015/03/05 09:06:20 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.12 2015/03/05 08:48:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.13 2015/03/05 09:06:20 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -231,7 +231,6 @@
        usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags,
            USBD_NO_TIMEOUT, cb);
        ipipe->up_intrxfer = xfer;
-       ipipe->up_intrbuf = buf;
        ipipe->up_repeat = 1;
        err = usbd_transfer(xfer);
        *pipe = ipipe;
@@ -275,10 +274,8 @@
        pipe->up_endpoint->ue_refcnt--;
        pipe->up_methods->upm_close(pipe);
        usbd_unlock_pipe(pipe);
-       if (pipe->up_intrxfer != NULL) {
+       if (pipe->up_intrxfer != NULL)
                usbd_free_xfer(pipe->up_intrxfer);
-               usbd_free_buffer(pipe->up_intrbuf);
-       }
        kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
        return USBD_NORMAL_COMPLETION;
 }
@@ -1072,7 +1069,6 @@
 {
        usbd_xfer_handle xfer;
        usbd_status err;
-       void *buf = NULL;
 
        USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
@@ -1083,13 +1079,14 @@
                return USBD_NOMEM;
 
        if (UGETW(req->wLength) != 0) {
-               buf = usbd_alloc_buffer(xfer, UGETW(req->wLength));
+               void *buf = usbd_alloc_buffer(xfer, UGETW(req->wLength));
                if (buf == NULL) {
                        err = ENOMEM;
                        goto bad;
                }
        }
 
+
        usbd_setup_default_xfer(xfer, dev, 0, timeout, req,
                                data, UGETW(req->wLength), flags, 0);
        xfer->ux_pipe = pipe;
@@ -1152,8 +1149,6 @@
                    usbd_errstr(err), 0, 0, 0);
        }
        usbd_free_xfer(xfer);
-       if (buf)
-               usbd_free_buffer(buf);
        return err;
 }
 
diff -r 82fb4ed8dff3 -r af6d90fcc60a sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h    Thu Mar 05 08:48:07 2015 +0000
+++ b/sys/dev/usb/usbdivar.h    Thu Mar 05 09:06:20 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdivar.h,v 1.109.2.13 2015/03/05 08:48:07 skrll Exp $        */
+/*     $NetBSD: usbdivar.h,v 1.109.2.14 2015/03/05 09:06:20 skrll Exp $        */
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -225,7 +225,6 @@
        struct usb_task         up_async_task;
 
        usbd_xfer_handle        up_intrxfer; /* used for repeating requests */
-       void                   *up_intrbuf;
        char                    up_repeat;
        int                     up_interval;
        uint8_t                 up_flags;



Home | Main Index | Thread Index | Old Index