Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6967121 authored by Rohith Kollalsi's avatar Rohith Kollalsi
Browse files

usb: dwc3: Delete the request from pending list in case of ep queue failure



While queuing the request to an ep we add the request to pending list
and after adding, if usb disconnect occurs then ep queue failure is
seen and the request which is added to pending list will be added back
to the pool in function driver without deleting the request from pending
list. As a part of disconnect we call gadget_giveback_request which will
give back requests from the pending list to the function driver and the
same request will be added to the pool again.

To prevent the same request to be added to pool twice delete the request
from pending list when ep_queue fails.

Change-Id: I0f679266257e969f75b14e06add2e3f4bb894dfb
Signed-off-by: default avatarRohith Kollalsi <rkollals@codeaurora.org>
parent 12388772
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1558,6 +1558,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
{
	struct dwc3		*dwc = dep->dwc;
	int ret = 0;

	if (!dep->endpoint.desc || !dwc->pullups_connected) {
		dev_err_ratelimited(dwc->dev, "%s: can't queue to disabled endpoint\n",
@@ -1604,7 +1605,11 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
		}
	}

	return __dwc3_gadget_kick_transfer(dep);
	ret = __dwc3_gadget_kick_transfer(dep);
	if (ret < 0)
		list_del_init(&req->list);

	return ret;
}

static int dwc3_gadget_wakeup(struct usb_gadget *g)
+4 −1
Original line number Diff line number Diff line
@@ -949,7 +949,10 @@ static void usb_cser_start_rx(struct f_cdev *port)
		if (ret) {
			pr_err("port(%d):%pK usb ep(%s) queue failed\n",
					port->port_num, port, ep->name);
			list_add(&req->list, pool);
			if (port->is_connected)
				list_add(&req->list, &port->read_pool);
			else
				usb_cser_free_req(port->port_usb.out, req);
			break;
		}
	}