Module Name: src
Committed By: skrll
Date: Wed Oct 26 07:31:24 UTC 2016
Modified Files:
src/sys/dev/usb [nick-nhusb]: usb_subr.c
Log Message:
PR kern/48243 (inconsistant usage of 'up->parent' in usb_subr.c)
Add a KASSERT and comment to explain what's going on.
To generate a diff of this commit:
cvs rdiff -u -r1.198.2.34 -r1.198.2.35 src/sys/dev/usb/usb_subr.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_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.198.2.34 src/sys/dev/usb/usb_subr.c:1.198.2.35
--- src/sys/dev/usb/usb_subr.c:1.198.2.34 Fri Oct 7 10:37:42 2016
+++ src/sys/dev/usb/usb_subr.c Wed Oct 26 07:31:24 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.198.2.34 2016/10/07 10:37:42 skrll Exp $ */
+/* $NetBSD: usb_subr.c,v 1.198.2.35 2016/10/26 07:31:24 skrll Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.34 2016/10/07 10:37:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.35 2016/10/26 07:31:24 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1261,6 +1261,11 @@ usbd_new_device(device_t parent, struct
err = usbd_get_initial_ddesc(dev, dd);
if (!err)
break;
+ /*
+ * The root hub can never fail to give the initial descriptor,
+ * but assert it just in case.
+ */
+ KASSERT(up->up_parent);
usbd_delay_ms(dev, 200);
if ((i & 3) == 3)
usbd_reset_port(up->up_parent, port, &ps);