More 2.4 OHCI "we can pull the PCMCIA card whenever we want" bugs found:
- One missing usb_dec_dev_use() call.
- One endless loop due to undetected card removal.
- One restarted timer despite now-sadly-missing hardware.

Please apply on top of my last patch.

Signed-off-by: Matthias Urlichs <[EMAIL PROTECTED]>

_

===== drivers/usb/host/usb-ohci.c 1.38 vs edited =====
--- 1.38/drivers/usb/host/usb-ohci.c    2004-11-08 11:54:15 +00:00
+++ edited/drivers/usb/host/usb-ohci.c  2004-11-11 12:41:02 +00:00
@@ -844,6 +844,7 @@
                                remove_wait_queue (&unlink_wakeup, &wait); 
                                if (urb->status == USB_ST_URB_PENDING) {
                                        err ("unlink URB timeout");
+                                       usb_dec_dev_use (urb->dev);
                                        return -ETIMEDOUT;
                                }
 
@@ -1870,11 +1871,14 @@
 
        num_ports = roothub_a (ohci) & RH_A_NDP; 
        if (num_ports > MAX_ROOT_PORTS) {
-               err ("bogus NDP=%d for OHCI usb-%s", num_ports,
-                       ohci->ohci_dev->slot_name);
-               err ("rereads as NDP=%d",
-                       readl (&ohci->regs->roothub.a) & RH_A_NDP);
-               /* retry later; "should not happen" */
+               if (num_ports == 0xFF) { /* hardware vanished */
+                       ohci->disabled++;
+               } else { /* otherwise retry later; "should not happen" */
+                       err ("bogus NDP=%d for OHCI usb-%s", num_ports,
+                               ohci->ohci_dev->slot_name);
+                       err ("rereads as NDP=%d",
+                               readl (&ohci->regs->roothub.a) & RH_A_NDP);
+               }
                return 0;
        }
        *(__u8 *) data = (roothub_status (ohci) & (RH_HS_LPSC | RH_HS_OCIC))
@@ -1929,7 +1933,8 @@
                }
        }
  out:
-       rh_init_int_timer (urb);
+       if (!ohci->disabled)
+               rh_init_int_timer (urb);
 }
 
 /*-------------------------------------------------------------------------*/
-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to