summaryrefslogtreecommitdiff
path: root/drivers/staging/ccg
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/ccg')
-rw-r--r--drivers/staging/ccg/u_serial.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/ccg/u_serial.c b/drivers/staging/ccg/u_serial.c
index 5b3f5fffea92..373c40656b52 100644
--- a/drivers/staging/ccg/u_serial.c
+++ b/drivers/staging/ccg/u_serial.c
@@ -1140,8 +1140,10 @@ int gserial_setup(struct usb_gadget *g, unsigned count)
return status;
fail:
- while (count--)
+ while (count--) {
+ tty_port_destroy(&ports[count].port->port);
kfree(ports[count].port);
+ }
put_tty_driver(gs_tty_driver);
gs_tty_driver = NULL;
return status;
@@ -1195,6 +1197,7 @@ void gserial_cleanup(void)
WARN_ON(port->port_usb != NULL);
+ tty_port_destroy(&port->port);
kfree(port);
}
n_ports = 0;