USB: msm72k_udc: Check if the ep is not disabled before queuing it

Queuing a request on a disabled endpoint during composition switch leads
to prime failure. Hence return -EINVAL if a request is queued on a disabled
endpoint.

Also, in f_mtp, block queuing a request in OUT ep in receive_file_work, if
the device state is STATE_OFFLINE.

Change-Id: I0e706d5280a2460baf6ab05dbf97a09c59b642fb
CRs-Fixed: 378207
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
This commit is contained in:
Rajkumar Raghupathy 2012-07-24 16:13:36 +05:30 committed by Stephen Boyd
parent abf379131b
commit ac9831de89
2 changed files with 10 additions and 1 deletions

View file

@ -788,7 +788,8 @@ static void receive_file_work(struct work_struct *data)
/* wait for our last read to complete */
ret = wait_event_interruptible(dev->read_wq,
dev->rx_done || dev->state != STATE_BUSY);
if (dev->state == STATE_CANCELED) {
if (dev->state == STATE_CANCELED
|| dev->state == STATE_OFFLINE) {
r = -ECANCELED;
if (!dev->rx_done)
usb_ep_dequeue(dev->ep_out, read_req);

View file

@ -702,6 +702,14 @@ int usb_ept_queue_xfer(struct msm_endpoint *ept, struct usb_request *_req)
spin_lock_irqsave(&ui->lock, flags);
if (ept->num != 0 && ept->ep.desc == NULL) {
req->req.status = -EINVAL;
spin_unlock_irqrestore(&ui->lock, flags);
dev_err(&ui->pdev->dev,
"%s: called for disabled endpoint\n", __func__);
return -EINVAL;
}
if (req->busy) {
req->req.status = -EBUSY;
spin_unlock_irqrestore(&ui->lock, flags);