aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/mos7840.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 7e998081e1cd..62b86a685082 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -914,20 +914,20 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
914 status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); 914 status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data);
915 if (status < 0) { 915 if (status < 0) {
916 dev_dbg(&port->dev, "Reading Spreg failed\n"); 916 dev_dbg(&port->dev, "Reading Spreg failed\n");
917 return -1; 917 goto err;
918 } 918 }
919 Data |= 0x80; 919 Data |= 0x80;
920 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); 920 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
921 if (status < 0) { 921 if (status < 0) {
922 dev_dbg(&port->dev, "writing Spreg failed\n"); 922 dev_dbg(&port->dev, "writing Spreg failed\n");
923 return -1; 923 goto err;
924 } 924 }
925 925
926 Data &= ~0x80; 926 Data &= ~0x80;
927 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); 927 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
928 if (status < 0) { 928 if (status < 0) {
929 dev_dbg(&port->dev, "writing Spreg failed\n"); 929 dev_dbg(&port->dev, "writing Spreg failed\n");
930 return -1; 930 goto err;
931 } 931 }
932 /* End of block to be checked */ 932 /* End of block to be checked */
933 933
@@ -936,7 +936,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
936 &Data); 936 &Data);
937 if (status < 0) { 937 if (status < 0) {
938 dev_dbg(&port->dev, "Reading Controlreg failed\n"); 938 dev_dbg(&port->dev, "Reading Controlreg failed\n");
939 return -1; 939 goto err;
940 } 940 }
941 Data |= 0x08; /* Driver done bit */ 941 Data |= 0x08; /* Driver done bit */
942 Data |= 0x20; /* rx_disable */ 942 Data |= 0x20; /* rx_disable */
@@ -944,7 +944,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
944 mos7840_port->ControlRegOffset, Data); 944 mos7840_port->ControlRegOffset, Data);
945 if (status < 0) { 945 if (status < 0) {
946 dev_dbg(&port->dev, "writing Controlreg failed\n"); 946 dev_dbg(&port->dev, "writing Controlreg failed\n");
947 return -1; 947 goto err;
948 } 948 }
949 /* do register settings here */ 949 /* do register settings here */
950 /* Set all regs to the device default values. */ 950 /* Set all regs to the device default values. */
@@ -955,21 +955,21 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
955 status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); 955 status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data);
956 if (status < 0) { 956 if (status < 0) {
957 dev_dbg(&port->dev, "disabling interrupts failed\n"); 957 dev_dbg(&port->dev, "disabling interrupts failed\n");
958 return -1; 958 goto err;
959 } 959 }
960 /* Set FIFO_CONTROL_REGISTER to the default value */ 960 /* Set FIFO_CONTROL_REGISTER to the default value */
961 Data = 0x00; 961 Data = 0x00;
962 status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); 962 status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
963 if (status < 0) { 963 if (status < 0) {
964 dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n"); 964 dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n");
965 return -1; 965 goto err;
966 } 966 }
967 967
968 Data = 0xcf; 968 Data = 0xcf;
969 status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); 969 status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
970 if (status < 0) { 970 if (status < 0) {
971 dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n"); 971 dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n");
972 return -1; 972 goto err;
973 } 973 }
974 974
975 Data = 0x03; 975 Data = 0x03;
@@ -1114,6 +1114,15 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
1114 /* mos7840_change_port_settings(mos7840_port,old_termios); */ 1114 /* mos7840_change_port_settings(mos7840_port,old_termios); */
1115 1115
1116 return 0; 1116 return 0;
1117err:
1118 for (j = 0; j < NUM_URBS; ++j) {
1119 urb = mos7840_port->write_urb_pool[j];
1120 if (!urb)
1121 continue;
1122 kfree(urb->transfer_buffer);
1123 usb_free_urb(urb);
1124 }
1125 return status;
1117} 1126}
1118 1127
1119/***************************************************************************** 1128/*****************************************************************************