]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Don't retire active transaction on a NAK
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 21 Aug 2010 11:55:06 +0000 (13:55 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 21 Aug 2010 11:55:06 +0000 (13:55 +0200)
bus/usb/uhci.c

index 0bba24b54b6251c45398174cc5835c1bcbce67f5..d0416d7e23d9940078cfd74489f9386ba34de60a 100644 (file)
@@ -519,32 +519,35 @@ grub_uhci_transfer (grub_usb_controller_t dev,
 
       grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status);
 
-      /* Check if the endpoint is stalled.  */
-      if (errtd->ctrl_status & (1 << 22))
-       err = GRUB_USB_ERR_STALL;
+      if (!(errtd->ctrl_status & (1 << 23)))
+       {
+         /* Check if the endpoint is stalled.  */
+         if (errtd->ctrl_status & (1 << 22))
+           err = GRUB_USB_ERR_STALL;
 
-      /* Check if an error related to the data buffer occurred.  */
-      if (errtd->ctrl_status & (1 << 21))
-       err = GRUB_USB_ERR_DATA;
+         /* Check if an error related to the data buffer occurred.  */
+         if (errtd->ctrl_status & (1 << 21))
+           err = GRUB_USB_ERR_DATA;
 
-      /* Check if a babble error occurred.  */
-      if (errtd->ctrl_status & (1 << 20))
-       err = GRUB_USB_ERR_BABBLE;
+         /* Check if a babble error occurred.  */
+         if (errtd->ctrl_status & (1 << 20))
+           err = GRUB_USB_ERR_BABBLE;
 
-      /* Check if a NAK occurred.  */
-      if (errtd->ctrl_status & (1 << 19))
-       err = GRUB_USB_ERR_NAK;
+         /* Check if a NAK occurred.  */
+         if (errtd->ctrl_status & (1 << 19))
+           err = GRUB_USB_ERR_NAK;
 
-      /* Check if a timeout occurred.  */
-      if (errtd->ctrl_status & (1 << 18))
-       err = GRUB_USB_ERR_TIMEOUT;
+         /* Check if a timeout occurred.  */
+         if (errtd->ctrl_status & (1 << 18))
+           err = GRUB_USB_ERR_TIMEOUT;
 
-      /* Check if a bitstuff error occurred.  */
-      if (errtd->ctrl_status & (1 << 17))
-       err = GRUB_USB_ERR_BITSTUFF;
+         /* Check if a bitstuff error occurred.  */
+         if (errtd->ctrl_status & (1 << 17))
+           err = GRUB_USB_ERR_BITSTUFF;
 
-      if (err)
-       goto fail;
+         if (err)
+           break;
+       }
 
       /* Fall through, no errors occurred, so the QH might be
         updated.  */
@@ -554,17 +557,15 @@ grub_uhci_transfer (grub_usb_controller_t dev,
        {
          err = GRUB_USB_ERR_STALL;
          grub_dprintf ("uhci", "transaction timed out\n");
-         goto fail;
+         break;
        }
       grub_cpu_idle ();
     }
 
-  grub_dprintf ("uhci", "transaction complete\n");
-
- fail:
-
   if (err != GRUB_USB_ERR_NONE)
     grub_dprintf ("uhci", "transaction failed\n");
+  else
+    grub_dprintf ("uhci", "transaction complete\n");
 
   /* Place the QH back in the free list and deallocate the associated
      TDs.  */