aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/serial/sierra.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 4865aff892e8..644607de4c11 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -577,7 +577,12 @@ static void sierra_shutdown(struct usb_serial *serial)
577 /* Stop reading/writing urbs */ 577 /* Stop reading/writing urbs */
578 for (i = 0; i < serial->num_ports; ++i) { 578 for (i = 0; i < serial->num_ports; ++i) {
579 port = serial->port[i]; 579 port = serial->port[i];
580 if (!port)
581 continue;
580 portdata = usb_get_serial_port_data(port); 582 portdata = usb_get_serial_port_data(port);
583 if (!portdata)
584 continue;
585
581 for (j = 0; j < N_IN_URB; j++) 586 for (j = 0; j < N_IN_URB; j++)
582 usb_unlink_urb(portdata->in_urbs[j]); 587 usb_unlink_urb(portdata->in_urbs[j]);
583 for (j = 0; j < N_OUT_URB; j++) 588 for (j = 0; j < N_OUT_URB; j++)
@@ -587,7 +592,11 @@ static void sierra_shutdown(struct usb_serial *serial)
587 /* Now free them */ 592 /* Now free them */
588 for (i = 0; i < serial->num_ports; ++i) { 593 for (i = 0; i < serial->num_ports; ++i) {
589 port = serial->port[i]; 594 port = serial->port[i];
595 if (!port)
596 continue;
590 portdata = usb_get_serial_port_data(port); 597 portdata = usb_get_serial_port_data(port);
598 if (!portdata)
599 continue;
591 600
592 for (j = 0; j < N_IN_URB; j++) { 601 for (j = 0; j < N_IN_URB; j++) {
593 if (portdata->in_urbs[j]) { 602 if (portdata->in_urbs[j]) {
@@ -606,6 +615,8 @@ static void sierra_shutdown(struct usb_serial *serial)
606 /* Now free per port private data */ 615 /* Now free per port private data */
607 for (i = 0; i < serial->num_ports; i++) { 616 for (i = 0; i < serial->num_ports; i++) {
608 port = serial->port[i]; 617 port = serial->port[i];
618 if (!port)
619 continue;
609 kfree(usb_get_serial_port_data(port)); 620 kfree(usb_get_serial_port_data(port));
610 } 621 }
611} 622}