Skip to content

Commit 0d2ada0

Browse files
Mark Tomlinsongregkh
authored andcommitted
usb: host: max3421-hcd: Correctly abort a USB request.
If the current USB request was aborted, the spi thread would not respond to any further requests. This is because the "curr_urb" pointer would not become NULL, so no further requests would be taken off the queue. The solution here is to set the "urb_done" flag, as this will cause the correct handling of the URB. Also clear interrupts that should only be expected if an URB is in progress. Fixes: 2d53139 ("Add support for using a MAX3421E chip as a host driver.") Cc: stable <[email protected]> Signed-off-by: Mark Tomlinson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 282615d commit 0d2ada0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/usb/host/max3421-hcd.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,17 @@ max3421_check_unlink(struct usb_hcd *hcd)
779779
retval = 1;
780780
dev_dbg(&spi->dev, "%s: URB %p unlinked=%d",
781781
__func__, urb, urb->unlinked);
782-
usb_hcd_unlink_urb_from_ep(hcd, urb);
783-
spin_unlock_irqrestore(&max3421_hcd->lock,
784-
flags);
785-
usb_hcd_giveback_urb(hcd, urb, 0);
786-
spin_lock_irqsave(&max3421_hcd->lock, flags);
782+
if (urb == max3421_hcd->curr_urb) {
783+
max3421_hcd->urb_done = 1;
784+
max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) |
785+
BIT(MAX3421_HI_RCVDAV_BIT));
786+
} else {
787+
usb_hcd_unlink_urb_from_ep(hcd, urb);
788+
spin_unlock_irqrestore(&max3421_hcd->lock,
789+
flags);
790+
usb_hcd_giveback_urb(hcd, urb, 0);
791+
spin_lock_irqsave(&max3421_hcd->lock, flags);
792+
}
787793
}
788794
}
789795
}

0 commit comments

Comments
 (0)