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

Commit 950a3a3f authored by Rajkumar Raghupathy's avatar Rajkumar Raghupathy Committed by Stephen Boyd
Browse files

USB: Gadget: u_serial: Freeing usb requests as a part of gs_close



The usb requests allocated during gs_open() were freed only as a part of
usb disconnect previously. So freeing the usb requests as a part of
gs_close() helps to free the requests on every network disconnect also.

Change-Id: I6edcab3cba94902ea3cb1a043403c93afa8c9d52
Signed-off-by: default avatarRajkumar Raghupathy <raghup@codeaurora.org>
parent 272d2fd1
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -941,6 +941,22 @@ static void gs_close(struct tty_struct *tty, struct file *file)
			port->port_num, tty, file);

	wake_up(&port->port.close_wait);

	/*
	 * Freeing the previously queued requests as they are
	 * allocated again as a part of gs_open()
	 */
	if (port->port_usb) {
		spin_unlock_irq(&port->port_lock);
		usb_ep_fifo_flush(gser->out);
		usb_ep_fifo_flush(gser->in);
		spin_lock_irq(&port->port_lock);
		gs_free_requests(gser->out, &port->read_queue, NULL);
		gs_free_requests(gser->out, &port->read_pool, NULL);
		gs_free_requests(gser->in, &port->write_pool, NULL);
	}
	port->read_allocated = port->read_started =
		port->write_allocated = port->write_started = 0;
exit:
	spin_unlock_irq(&port->port_lock);
}