raspberrypi/linux — pull request #337 by P33M (2013-07-22 13:33:29+00:00)
Title: dwc_otg: prevent BUG() in TT allocation if hub address is > 16

Previously if you did this:

1) Use external hub
2a) Unplug and replug it lots of times, or
2b) Have a dodgy power supply or cable that caused lots of device resets

then a crash like this would invariably result:

```
[ 53.436564] ------------[ cut here ]------------
[ 53.453486] kernel BUG at drivers/usb/host/dwc_otg/dwc_otg_hcd.c:1310!
[ 53.466059] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM

Entering kdb (current=0xc05131c8, pid 0) Oops: (null)
due to oops @ 0xc0298678

Pid: 0, comm: swapper
CPU: 0 Not tainted (3.6.11portbug+ #16)
PC is at dwc_otg_hcd_allocate_port+0x9c/0xf4
LR is at dwc_otg_hcd_allocate_port+0xe0/0xf4
pc : [] lr : [] psr: 200001d3
sp : c0509e58 ip : 60000193 fp : caa30768
r10: ca97f814 r9 : ca97f800 r8 : c05df3b8
r7 : caa30740 r6 : 00000001 r5 : ca97f800 r4 : caa30740
r3 : 00000000 r2 : 0000011f r1 : 00000000 r0 : 00000025
Flags: nzCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel
Control: 00c5387d Table: 09960008 DAC: 00000017
```
With the patch applied I can now unplug/replug the hub all the way to address 127, whereupon the address assignment wraps back around.