diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2014-12-04 10:21:56 -0500 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-01-29 15:44:40 +0100 |
commit | 879e2c48f34bd5c41b7ea5902035dbce40931aaa (patch) | |
tree | 9d513de7c140369d4b1d66a1a036045531d15394 | |
parent | 8f3084c44b70ee9e8f5b6bd4816a129bc2646f21 (diff) | |
download | lwn-879e2c48f34bd5c41b7ea5902035dbce40931aaa.tar.gz lwn-879e2c48f34bd5c41b7ea5902035dbce40931aaa.zip |
USB: EHCI: fix initialization bug in iso_stream_schedule()
commit 6d89252a998a695ecb0348fc2d717dc33d90cae9 upstream.
Commit c3ee9b76aa93 (EHCI: improved logic for isochronous scheduling)
introduced the idea of using ehci->last_iso_frame as the origin (or
base) for the circular calculations involved in modifying the
isochronous schedule. However, the new code it added used
ehci->last_iso_frame before the value was properly initialized. This
patch rectifies the mistake by moving the initialization lines earlier
in iso_stream_schedule().
This fixes Bugzilla #72891.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: c3ee9b76aa93
Reported-by: Joe Bryant <tenminjoe@yahoo.com>
Tested-by: Joe Bryant <tenminjoe@yahoo.com>
Tested-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 85dd24ed97a6..8ecf164f0318 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c @@ -1384,6 +1384,10 @@ iso_stream_schedule ( now = ehci_read_frame_index(ehci) & (mod - 1); + /* If needed, initialize last_iso_frame so that this URB will be seen */ + if (ehci->isoc_count == 0) + ehci->last_iso_frame = now >> 3; + /* Typical case: reuse current schedule, stream is still active. * Hopefully there are no gaps from the host falling behind * (irq delays etc). If there are, the behavior depends on @@ -1493,10 +1497,6 @@ iso_stream_schedule ( urb->start_frame = stream->next_uframe; if (!stream->highspeed) urb->start_frame >>= 3; - - /* Make sure scan_isoc() sees these */ - if (ehci->isoc_count == 0) - ehci->last_iso_frame = now >> 3; return 0; fail: |