Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195525
b: refs/heads/master
c: 6d1bf48
h: refs/heads/master
i:
  195523: 555b29d
v: v3
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed May 20, 2010
1 parent 39b3244 commit 2e264f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 12e2e52cc578714d5824a27dd1a131a5418d636b
refs/heads/master: 6d1bf48e240bde4e9c7313ccdd2fe32f37f67ad4
43 changes: 21 additions & 22 deletions trunk/drivers/usb/serial/safe_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ static void safe_process_read_urb(struct urb *urb)
struct usb_serial_port *port = urb->context;
unsigned char *data = urb->transfer_buffer;
unsigned char length = urb->actual_length;
int actual_length;
struct tty_struct *tty;
__u16 fcs;

if (!length)
return;
Expand All @@ -227,30 +229,27 @@ static void safe_process_read_urb(struct urb *urb)
if (!tty)
return;

if (safe) {
__u16 fcs;
fcs = fcs_compute10(data, length, CRC10_INITFCS);
if (!fcs) {
int actual_length = data[length - 2] >> 2;
if (actual_length <= (length - 2)) {
dev_info(&urb->dev->dev, "%s - actual: %d\n",
__func__, actual_length);
tty_insert_flip_string(tty,
data, actual_length);
tty_flip_buffer_push(tty);
} else {
dev_err(&port->dev,
"%s - inconsistent lengths %d:%d\n",
__func__, actual_length, length);
}
} else {
dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
}
} else {
tty_insert_flip_string(tty, data, length);
tty_flip_buffer_push(tty);
if (!safe)
goto out;

fcs = fcs_compute10(data, length, CRC10_INITFCS);
if (fcs) {
dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
goto err;
}

actual_length = data[length - 2] >> 2;
if (actual_length > (length - 2)) {
dev_err(&port->dev, "%s - inconsistent lengths %d:%d\n",
__func__, actual_length, length);
goto err;
}
dev_info(&urb->dev->dev, "%s - actual: %d\n", __func__, actual_length);
length = actual_length;
out:
tty_insert_flip_string(tty, data, length);
tty_flip_buffer_push(tty);
err:
tty_kref_put(tty);
}

Expand Down

0 comments on commit 2e264f0

Please sign in to comment.