Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/usb Pull up following revision(s) (requested by s...
details: https://anonhg.NetBSD.org/src/rev/60098640050b
branches: netbsd-8
changeset: 434140:60098640050b
user: snj <snj%NetBSD.org@localhost>
date: Tue Jul 25 01:39:41 2017 +0000
description:
Pull up following revision(s) (requested by skrll in ticket #136):
sys/dev/usb/uhci.c: revision 1.276
Only call uhci_free_stds if there are TDs to free.
In uhci_alloc_std_chain ensure we fill the TD array correctly and note
the number of allocated TDs so that uhci_free_stds will do the right thing
Fixes a problem seen by anon
diffstat:
sys/dev/usb/uhci.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diffs (82 lines):
diff -r 408c791d149d -r 60098640050b sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Tue Jul 25 01:38:42 2017 +0000
+++ b/sys/dev/usb/uhci.c Tue Jul 25 01:39:41 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.275 2017/06/01 02:45:12 chs Exp $ */
+/* $NetBSD: uhci.c,v 1.275.2.1 2017/07/25 01:39:41 snj Exp $ */
/*
* Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.275 2017/06/01 02:45:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.275.2.1 2017/07/25 01:39:41 snj Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1995,7 +1995,6 @@
uxfer->ux_stds = NULL;
uxfer->ux_nstd = ntd;
- p = NULL;
if (ntd == 0) {
*sp = NULL;
DPRINTF("ntd=0", 0, 0, 0, 0);
@@ -2004,11 +2003,13 @@
uxfer->ux_stds = kmem_alloc(sizeof(uhci_soft_td_t *) * ntd,
KM_SLEEP);
- ntd--;
- for (int i = ntd; i >= 0; i--) {
+ for (int i = 0; i < ntd; i++) {
p = uhci_alloc_std(sc);
if (p == NULL) {
- uhci_free_stds(sc, uxfer);
+ if (i != 0) {
+ uxfer->ux_nstd = i;
+ uhci_free_stds(sc, uxfer);
+ }
kmem_free(uxfer->ux_stds,
sizeof(uhci_soft_td_t *) * ntd);
return ENOMEM;
@@ -2212,9 +2213,10 @@
KASSERT(ux->ux_type == UX_BULK);
- uhci_free_stds(sc, ux);
- if (ux->ux_nstd)
+ if (ux->ux_nstd) {
+ uhci_free_stds(sc, ux);
kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd);
+ }
}
usbd_status
@@ -2482,9 +2484,10 @@
KASSERT(ux->ux_type == UX_CTRL);
- uhci_free_stds(sc, ux);
- if (ux->ux_nstd)
+ if (ux->ux_nstd) {
+ uhci_free_stds(sc, ux);
kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd);
+ }
}
usbd_status
@@ -2687,9 +2690,10 @@
KASSERT(ux->ux_type == UX_INTR);
- uhci_free_stds(sc, ux);
- if (ux->ux_nstd)
+ if (ux->ux_nstd) {
+ uhci_free_stds(sc, ux);
kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd);
+ }
}
usbd_status
Home |
Main Index |
Thread Index |
Old Index