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

Commit 1f11d4c0 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: u_bam_data: Check for port_usb after fifo allocation



Currently driver allocates memory for data fifo and descriptor fifo for
both pipes before configuring DBM endpoints and doing bam2bam connection
with IPA. There is a chance that disconnect happens and it might race with
previous connect_work. Hence add check after fifos allocation before
confgiuring DBM endpoints and going ahead with bam2bam connections.  Also
check whether request is NULL or not before queuing to USB controller.

Change-Id: I6d5cf8347b7722f512c7d93cd9ab58f0e4e10384
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent a8371783
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -590,7 +590,7 @@ static void bam_data_start_endless_rx(struct bam_data_port *port)
	int status;

	spin_lock_irqsave(&port->port_lock, flags);
	if (!port->port_usb) {
	if (!port->port_usb || !d->rx_req) {
		spin_unlock_irqrestore(&port->port_lock, flags);
		return;
	}
@@ -611,7 +611,7 @@ static void bam_data_start_endless_tx(struct bam_data_port *port)
	int status;

	spin_lock_irqsave(&port->port_lock, flags);
	if (!port->port_usb) {
	if (!port->port_usb || !d->tx_req) {
		spin_unlock_irqrestore(&port->port_lock, flags);
		return;
	}
@@ -922,6 +922,12 @@ static void bam2bam_data_connect_work(struct work_struct *w)
	usb_bam_alloc_fifos(d->usb_bam_type, d->dst_connection_idx);

	spin_lock_irqsave(&port->port_lock, flags);
	if (!port->port_usb) {
		pr_err("Disconnected.port_usb is NULL\n");
		spin_unlock_irqrestore(&port->port_lock, flags);
		goto free_fifos;
	}

	if (gadget_is_dwc3(gadget)) {
		/* Configure RX */
		configure_usb_data_fifo(d->usb_bam_type,