Commit c73c6dea authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] ohci-hcd, remove oops and...

Two changes, one big one not:

- check before traversing a null pointer, removing oops

- always do bandwidth checks, no point in allowing overcommit

That oops possibility has been there for a bit over two months,
but something changed recently which made me see it.   Maybe
sme other folk have seen this one too (in ed_deschedule).
parent 97664e0e
...@@ -83,7 +83,7 @@ static int balance (struct ohci_hcd *ohci, int interval, int load) ...@@ -83,7 +83,7 @@ static int balance (struct ohci_hcd *ohci, int interval, int load)
*/ */
for (i = 0; i < interval ; i++) { for (i = 0; i < interval ; i++) {
if (branch < 0 || ohci->load [branch] > ohci->load [i]) { if (branch < 0 || ohci->load [branch] > ohci->load [i]) {
#ifdef CONFIG_USB_BANDWIDTH #if 1 /* CONFIG_USB_BANDWIDTH */
int j; int j;
/* usb 1.1 says 90% of one frame */ /* usb 1.1 says 90% of one frame */
...@@ -276,7 +276,7 @@ static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) ...@@ -276,7 +276,7 @@ static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed)
ohci->ed_controltail = ed->ed_prev; ohci->ed_controltail = ed->ed_prev;
if (ohci->ed_controltail) if (ohci->ed_controltail)
ohci->ed_controltail->ed_next = 0; ohci->ed_controltail->ed_next = 0;
} else { } else if (ed->ed_next) {
ed->ed_next->ed_prev = ed->ed_prev; ed->ed_next->ed_prev = ed->ed_prev;
} }
break; break;
...@@ -297,7 +297,7 @@ static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) ...@@ -297,7 +297,7 @@ static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed)
ohci->ed_bulktail = ed->ed_prev; ohci->ed_bulktail = ed->ed_prev;
if (ohci->ed_bulktail) if (ohci->ed_bulktail)
ohci->ed_bulktail->ed_next = 0; ohci->ed_bulktail->ed_next = 0;
} else { } else if (ed->ed_next) {
ed->ed_next->ed_prev = ed->ed_prev; ed->ed_next->ed_prev = ed->ed_prev;
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment