aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/u_serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/u_serial.c')
-rw-r--r--drivers/usb/gadget/u_serial.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 88d4f5452c4..abf9505d3a7 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -1090,6 +1090,9 @@ void gserial_cleanup(void)
unsigned i;
struct gs_port *port;
+ if (!gs_tty_driver)
+ return;
+
/* start sysfs and /dev/ttyGS* node removal */
for (i = 0; i < n_ports; i++)
tty_unregister_device(gs_tty_driver, i);