diff options
author | David Brownell <david-b@pacbell.net> | 2007-12-19 14:30:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 17:34:58 -0500 |
commit | 340ba5f9cee6c7096162bfb2e0f7589f1ce0e142 (patch) | |
tree | a1096c2439d4420e0fd2156396ff4b7fd77494da /drivers/usb/host | |
parent | e96ffe2f9debd5fdc53144259d9e5faa514736b9 (diff) |
USB: ehci potential oops fix on ARC/TDI cores
Kernel bugzilla entry #9569 reports a potential OOPS in some code
supporting the integrated root hub TT support used on ARC/TDI
derived cores. (This seems to have been a longstanding issue.)
This patch cleans up usage of urb->dev->tt to avoid that potential
oops and also fixes some overly long lines.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-q.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 853e5e6396a5..776a97f33914 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -198,7 +198,8 @@ static int qtd_copy_status ( | |||
198 | 198 | ||
199 | /* if async CSPLIT failed, try cleaning out the TT buffer */ | 199 | /* if async CSPLIT failed, try cleaning out the TT buffer */ |
200 | if (status != -EPIPE | 200 | if (status != -EPIPE |
201 | && urb->dev->tt && !usb_pipeint (urb->pipe) | 201 | && urb->dev->tt |
202 | && !usb_pipeint(urb->pipe) | ||
202 | && ((token & QTD_STS_MMF) != 0 | 203 | && ((token & QTD_STS_MMF) != 0 |
203 | || QTD_CERR(token) == 0) | 204 | || QTD_CERR(token) == 0) |
204 | && (!ehci_is_TDI(ehci) | 205 | && (!ehci_is_TDI(ehci) |
@@ -211,6 +212,9 @@ static int qtd_copy_status ( | |||
211 | urb->dev->ttport, urb->dev->devnum, | 212 | urb->dev->ttport, urb->dev->devnum, |
212 | usb_pipeendpoint (urb->pipe), token); | 213 | usb_pipeendpoint (urb->pipe), token); |
213 | #endif /* DEBUG */ | 214 | #endif /* DEBUG */ |
215 | /* REVISIT ARC-derived cores don't clear the root | ||
216 | * hub TT buffer in this way... | ||
217 | */ | ||
214 | usb_hub_tt_clear_buffer (urb->dev, urb->pipe); | 218 | usb_hub_tt_clear_buffer (urb->dev, urb->pipe); |
215 | } | 219 | } |
216 | } | 220 | } |
@@ -638,6 +642,7 @@ qh_make ( | |||
638 | u32 info1 = 0, info2 = 0; | 642 | u32 info1 = 0, info2 = 0; |
639 | int is_input, type; | 643 | int is_input, type; |
640 | int maxp = 0; | 644 | int maxp = 0; |
645 | struct usb_tt *tt = urb->dev->tt; | ||
641 | 646 | ||
642 | if (!qh) | 647 | if (!qh) |
643 | return qh; | 648 | return qh; |
@@ -661,8 +666,9 @@ qh_make ( | |||
661 | * For control/bulk requests, the HC or TT handles these. | 666 | * For control/bulk requests, the HC or TT handles these. |
662 | */ | 667 | */ |
663 | if (type == PIPE_INTERRUPT) { | 668 | if (type == PIPE_INTERRUPT) { |
664 | qh->usecs = NS_TO_US (usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, | 669 | qh->usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH, |
665 | hb_mult (maxp) * max_packet (maxp))); | 670 | is_input, 0, |
671 | hb_mult(maxp) * max_packet(maxp))); | ||
666 | qh->start = NO_FRAME; | 672 | qh->start = NO_FRAME; |
667 | 673 | ||
668 | if (urb->dev->speed == USB_SPEED_HIGH) { | 674 | if (urb->dev->speed == USB_SPEED_HIGH) { |
@@ -680,7 +686,6 @@ qh_make ( | |||
680 | goto done; | 686 | goto done; |
681 | } | 687 | } |
682 | } else { | 688 | } else { |
683 | struct usb_tt *tt = urb->dev->tt; | ||
684 | int think_time; | 689 | int think_time; |
685 | 690 | ||
686 | /* gap is f(FS/LS transfer times) */ | 691 | /* gap is f(FS/LS transfer times) */ |
@@ -736,10 +741,8 @@ qh_make ( | |||
736 | /* set the address of the TT; for TDI's integrated | 741 | /* set the address of the TT; for TDI's integrated |
737 | * root hub tt, leave it zeroed. | 742 | * root hub tt, leave it zeroed. |
738 | */ | 743 | */ |
739 | if (!ehci_is_TDI(ehci) | 744 | if (tt && tt->hub != ehci_to_hcd(ehci)->self.root_hub) |
740 | || urb->dev->tt->hub != | 745 | info2 |= tt->hub->devnum << 16; |
741 | ehci_to_hcd(ehci)->self.root_hub) | ||
742 | info2 |= urb->dev->tt->hub->devnum << 16; | ||
743 | 746 | ||
744 | /* NOTE: if (PIPE_INTERRUPT) { scheduler sets c-mask } */ | 747 | /* NOTE: if (PIPE_INTERRUPT) { scheduler sets c-mask } */ |
745 | 748 | ||