diff options
Diffstat (limited to 'drivers/usb/serial/aircable.c')
-rw-r--r-- | drivers/usb/serial/aircable.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c index 79ea98c66fa8..99fb7dc59c45 100644 --- a/drivers/usb/serial/aircable.c +++ b/drivers/usb/serial/aircable.c | |||
@@ -272,7 +272,7 @@ static void aircable_read(struct work_struct *work) | |||
272 | * 64 bytes, to ensure I do not get throttled. | 272 | * 64 bytes, to ensure I do not get throttled. |
273 | * Ask USB mailing list for better aproach. | 273 | * Ask USB mailing list for better aproach. |
274 | */ | 274 | */ |
275 | tty = port->port.tty; | 275 | tty = tty_port_tty_get(&port->port); |
276 | 276 | ||
277 | if (!tty) { | 277 | if (!tty) { |
278 | schedule_work(&priv->rx_work); | 278 | schedule_work(&priv->rx_work); |
@@ -283,12 +283,13 @@ static void aircable_read(struct work_struct *work) | |||
283 | count = min(64, serial_buf_data_avail(priv->rx_buf)); | 283 | count = min(64, serial_buf_data_avail(priv->rx_buf)); |
284 | 284 | ||
285 | if (count <= 0) | 285 | if (count <= 0) |
286 | return; /* We have finished sending everything. */ | 286 | goto out; /* We have finished sending everything. */ |
287 | 287 | ||
288 | tty_prepare_flip_string(tty, &data, count); | 288 | tty_prepare_flip_string(tty, &data, count); |
289 | if (!data) { | 289 | if (!data) { |
290 | err("%s- kzalloc(%d) failed.", __func__, count); | 290 | dev_err(&port->dev, "%s- kzalloc(%d) failed.", |
291 | return; | 291 | __func__, count); |
292 | goto out; | ||
292 | } | 293 | } |
293 | 294 | ||
294 | serial_buf_get(priv->rx_buf, data, count); | 295 | serial_buf_get(priv->rx_buf, data, count); |
@@ -297,7 +298,8 @@ static void aircable_read(struct work_struct *work) | |||
297 | 298 | ||
298 | if (serial_buf_data_avail(priv->rx_buf)) | 299 | if (serial_buf_data_avail(priv->rx_buf)) |
299 | schedule_work(&priv->rx_work); | 300 | schedule_work(&priv->rx_work); |
300 | 301 | out: | |
302 | tty_kref_put(tty); | ||
301 | return; | 303 | return; |
302 | } | 304 | } |
303 | /* End of private methods */ | 305 | /* End of private methods */ |
@@ -495,7 +497,7 @@ static void aircable_read_bulk_callback(struct urb *urb) | |||
495 | usb_serial_debug_data(debug, &port->dev, __func__, | 497 | usb_serial_debug_data(debug, &port->dev, __func__, |
496 | urb->actual_length, urb->transfer_buffer); | 498 | urb->actual_length, urb->transfer_buffer); |
497 | 499 | ||
498 | tty = port->port.tty; | 500 | tty = tty_port_tty_get(&port->port); |
499 | if (tty && urb->actual_length) { | 501 | if (tty && urb->actual_length) { |
500 | if (urb->actual_length <= 2) { | 502 | if (urb->actual_length <= 2) { |
501 | /* This is an incomplete package */ | 503 | /* This is an incomplete package */ |
@@ -527,6 +529,7 @@ static void aircable_read_bulk_callback(struct urb *urb) | |||
527 | } | 529 | } |
528 | aircable_read(&priv->rx_work); | 530 | aircable_read(&priv->rx_work); |
529 | } | 531 | } |
532 | tty_kref_put(tty); | ||
530 | 533 | ||
531 | /* Schedule the next read _if_ we are still open */ | 534 | /* Schedule the next read _if_ we are still open */ |
532 | if (port->port.count) { | 535 | if (port->port.count) { |