aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/hso.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/hso.c')
-rw-r--r--drivers/net/usb/hso.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index fa4e58196c21..f78f0903b073 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -378,7 +378,7 @@ static void dbg_dump(int line_count, const char *func_name, unsigned char *buf,
378} 378}
379 379
380#define DUMP(buf_, len_) \ 380#define DUMP(buf_, len_) \
381 dbg_dump(__LINE__, __func__, buf_, len_) 381 dbg_dump(__LINE__, __func__, (unsigned char *)buf_, len_)
382 382
383#define DUMP1(buf_, len_) \ 383#define DUMP1(buf_, len_) \
384 do { \ 384 do { \
@@ -602,9 +602,9 @@ static struct hso_serial *get_serial_by_shared_int_and_type(
602 port = hso_mux_to_port(mux); 602 port = hso_mux_to_port(mux);
603 603
604 for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) { 604 for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) {
605 if (serial_table[i] 605 if (serial_table[i] &&
606 && (dev2ser(serial_table[i])->shared_int == shared_int) 606 (dev2ser(serial_table[i])->shared_int == shared_int) &&
607 && ((serial_table[i]->port_spec & HSO_PORT_MASK) == port)) { 607 ((serial_table[i]->port_spec & HSO_PORT_MASK) == port)) {
608 return dev2ser(serial_table[i]); 608 return dev2ser(serial_table[i]);
609 } 609 }
610 } 610 }
@@ -846,8 +846,8 @@ static void hso_net_tx_timeout(struct net_device *net)
846 dev_warn(&net->dev, "Tx timed out.\n"); 846 dev_warn(&net->dev, "Tx timed out.\n");
847 847
848 /* Tear the waiting frame off the list */ 848 /* Tear the waiting frame off the list */
849 if (odev->mux_bulk_tx_urb 849 if (odev->mux_bulk_tx_urb &&
850 && (odev->mux_bulk_tx_urb->status == -EINPROGRESS)) 850 (odev->mux_bulk_tx_urb->status == -EINPROGRESS))
851 usb_unlink_urb(odev->mux_bulk_tx_urb); 851 usb_unlink_urb(odev->mux_bulk_tx_urb);
852 852
853 /* Update statistics */ 853 /* Update statistics */
@@ -1020,9 +1020,9 @@ static void read_bulk_callback(struct urb *urb)
1020 u32 rest; 1020 u32 rest;
1021 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; 1021 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
1022 rest = urb->actual_length % odev->in_endp->wMaxPacketSize; 1022 rest = urb->actual_length % odev->in_endp->wMaxPacketSize;
1023 if (((rest == 5) || (rest == 6)) 1023 if (((rest == 5) || (rest == 6)) &&
1024 && !memcmp(((u8 *) urb->transfer_buffer) + 1024 !memcmp(((u8 *) urb->transfer_buffer) +
1025 urb->actual_length - 4, crc_check, 4)) { 1025 urb->actual_length - 4, crc_check, 4)) {
1026 urb->actual_length -= 4; 1026 urb->actual_length -= 4;
1027 } 1027 }
1028 } 1028 }
@@ -1226,9 +1226,9 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
1226 rest = 1226 rest =
1227 urb->actual_length % 1227 urb->actual_length %
1228 serial->in_endp->wMaxPacketSize; 1228 serial->in_endp->wMaxPacketSize;
1229 if (((rest == 5) || (rest == 6)) 1229 if (((rest == 5) || (rest == 6)) &&
1230 && !memcmp(((u8 *) urb->transfer_buffer) + 1230 !memcmp(((u8 *) urb->transfer_buffer) +
1231 urb->actual_length - 4, crc_check, 4)) { 1231 urb->actual_length - 4, crc_check, 4)) {
1232 urb->actual_length -= 4; 1232 urb->actual_length -= 4;
1233 } 1233 }
1234 } 1234 }
@@ -1363,7 +1363,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
1363 /* reset the rts and dtr */ 1363 /* reset the rts and dtr */
1364 /* do the actual close */ 1364 /* do the actual close */
1365 serial->open_count--; 1365 serial->open_count--;
1366 kref_put(&serial->parent->ref, hso_serial_ref_free); 1366
1367 if (serial->open_count <= 0) { 1367 if (serial->open_count <= 0) {
1368 serial->open_count = 0; 1368 serial->open_count = 0;
1369 spin_lock_irq(&serial->serial_lock); 1369 spin_lock_irq(&serial->serial_lock);
@@ -1383,6 +1383,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
1383 usb_autopm_put_interface(serial->parent->interface); 1383 usb_autopm_put_interface(serial->parent->interface);
1384 1384
1385 mutex_unlock(&serial->parent->mutex); 1385 mutex_unlock(&serial->parent->mutex);
1386
1387 kref_put(&serial->parent->ref, hso_serial_ref_free);
1386} 1388}
1387 1389
1388/* close the requested serial port */ 1390/* close the requested serial port */
@@ -1527,7 +1529,7 @@ static void tiocmget_intr_callback(struct urb *urb)
1527 dev_warn(&usb->dev, 1529 dev_warn(&usb->dev,
1528 "hso received invalid serial state notification\n"); 1530 "hso received invalid serial state notification\n");
1529 DUMP(serial_state_notification, 1531 DUMP(serial_state_notification,
1530 sizeof(hso_serial_state_notifation)) 1532 sizeof(struct hso_serial_state_notification));
1531 } else { 1533 } else {
1532 1534
1533 UART_state_bitmap = le16_to_cpu(serial_state_notification-> 1535 UART_state_bitmap = le16_to_cpu(serial_state_notification->
@@ -2980,8 +2982,8 @@ static int hso_probe(struct usb_interface *interface,
2980 2982
2981 case HSO_INTF_BULK: 2983 case HSO_INTF_BULK:
2982 /* It's a regular bulk interface */ 2984 /* It's a regular bulk interface */
2983 if (((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) 2985 if (((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) &&
2984 && !disable_net) 2986 !disable_net)
2985 hso_dev = hso_create_net_device(interface, port_spec); 2987 hso_dev = hso_create_net_device(interface, port_spec);
2986 else 2988 else
2987 hso_dev = 2989 hso_dev =
@@ -3144,8 +3146,8 @@ static void hso_free_interface(struct usb_interface *interface)
3144 int i; 3146 int i;
3145 3147
3146 for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) { 3148 for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) {
3147 if (serial_table[i] 3149 if (serial_table[i] &&
3148 && (serial_table[i]->interface == interface)) { 3150 (serial_table[i]->interface == interface)) {
3149 hso_dev = dev2ser(serial_table[i]); 3151 hso_dev = dev2ser(serial_table[i]);
3150 spin_lock_irq(&hso_dev->serial_lock); 3152 spin_lock_irq(&hso_dev->serial_lock);
3151 tty = tty_kref_get(hso_dev->tty); 3153 tty = tty_kref_get(hso_dev->tty);
@@ -3161,8 +3163,8 @@ static void hso_free_interface(struct usb_interface *interface)
3161 } 3163 }
3162 3164
3163 for (i = 0; i < HSO_MAX_NET_DEVICES; i++) { 3165 for (i = 0; i < HSO_MAX_NET_DEVICES; i++) {
3164 if (network_table[i] 3166 if (network_table[i] &&
3165 && (network_table[i]->interface == interface)) { 3167 (network_table[i]->interface == interface)) {
3166 struct rfkill *rfk = dev2net(network_table[i])->rfkill; 3168 struct rfkill *rfk = dev2net(network_table[i])->rfkill;
3167 /* hso_stop_net_device doesn't stop the net queue since 3169 /* hso_stop_net_device doesn't stop the net queue since
3168 * traffic needs to start it again when suspended */ 3170 * traffic needs to start it again when suspended */