Module Name: src Committed By: matthias Date: Sun Apr 25 09:14:39 UTC 2010
Modified Files: src/sys/dev/usb: usb_subr.c Log Message: Fix for PR#42572. I was running with this patch for several month without any problems. To generate a diff of this commit: cvs rdiff -u -r1.167 -r1.168 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.167 src/sys/dev/usb/usb_subr.c:1.168 --- src/sys/dev/usb/usb_subr.c:1.167 Thu Nov 12 20:11:35 2009 +++ src/sys/dev/usb/usb_subr.c Sun Apr 25 09:14:38 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.167 2009/11/12 20:11:35 dyoung Exp $ */ +/* $NetBSD: usb_subr.c,v 1.168 2010/04/25 09:14:38 matthias 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.167 2009/11/12 20:11:35 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.168 2010/04/25 09:14:38 matthias Exp $"); #include "opt_compat_netbsd.h" #include "opt_usbverbose.h" @@ -1158,14 +1158,6 @@ USETW(dev->def_ep_desc.wMaxPacketSize, dd->bMaxPacketSize); - err = usbd_reload_device_desc(dev); - if (err) { - DPRINTFN(-1, ("usbd_new_device: addr=%d, getting full desc " - "failed\n", addr)); - usbd_remove_device(dev, up); - return (err); - } - /* Set the address */ DPRINTFN(5, ("usbd_new_device: setting device address=%d\n", addr)); err = usbd_set_address(dev, addr); @@ -1181,6 +1173,14 @@ dev->address = addr; /* new device address now */ bus->devices[addr] = dev; + err = usbd_reload_device_desc(dev); + if (err) { + DPRINTFN(-1, ("usbd_new_device: addr=%d, getting full desc " + "failed\n", addr)); + usbd_remove_device(dev, up); + return (err); + } + /* Re-establish the default pipe with the new address. */ usbd_kill_pipe(dev->default_pipe); err = usbd_setup_pipe(dev, 0, &dev->def_ep, USBD_DEFAULT_INTERVAL,