diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-12-10 19:00:30 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-07 13:00:06 -0500 |
commit | 50de36f7af3b1d791c402478210790c582126fe5 (patch) | |
tree | 78d3353450be45315bb2ffa1cd7c664c26458c73 /drivers/usb/serial/spcp8x5.c | |
parent | 6013bbbab0dcbc43bcf9dd70beeab2a0b1ec5ea7 (diff) |
USB: serial: fix up urb->status usage
Some of the usb-serial drivers are starting to use urb->status in ways
they should not be doing. This fixes up some of them to prevent that.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/spcp8x5.c')
-rw-r--r-- | drivers/usb/serial/spcp8x5.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index a65bc2bd8e71..5e7528cc81a8 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -709,21 +709,20 @@ static void spcp8x5_read_bulk_callback(struct urb *urb) | |||
709 | unsigned char *data = urb->transfer_buffer; | 709 | unsigned char *data = urb->transfer_buffer; |
710 | unsigned long flags; | 710 | unsigned long flags; |
711 | int i; | 711 | int i; |
712 | int result; | 712 | int result = urb->status; |
713 | u8 status = 0; | 713 | u8 status; |
714 | char tty_flag; | 714 | char tty_flag; |
715 | 715 | ||
716 | dev_dbg(&port->dev, "start, urb->status = %d, " | 716 | dev_dbg(&port->dev, "start, result = %d, urb->actual_length = %d\n,", |
717 | "urb->actual_length = %d\n,", urb->status, urb->actual_length); | 717 | result, urb->actual_length); |
718 | 718 | ||
719 | /* check the urb status */ | 719 | /* check the urb status */ |
720 | if (urb->status) { | 720 | if (result) { |
721 | if (!port->port.count) | 721 | if (!port->port.count) |
722 | return; | 722 | return; |
723 | if (urb->status == -EPROTO) { | 723 | if (result == -EPROTO) { |
724 | /* spcp8x5 mysteriously fails with -EPROTO */ | 724 | /* spcp8x5 mysteriously fails with -EPROTO */ |
725 | /* reschedule the read */ | 725 | /* reschedule the read */ |
726 | urb->status = 0; | ||
727 | urb->dev = port->serial->dev; | 726 | urb->dev = port->serial->dev; |
728 | result = usb_submit_urb(urb , GFP_ATOMIC); | 727 | result = usb_submit_urb(urb , GFP_ATOMIC); |
729 | if (result) | 728 | if (result) |
@@ -833,8 +832,9 @@ static void spcp8x5_write_bulk_callback(struct urb *urb) | |||
833 | struct usb_serial_port *port = urb->context; | 832 | struct usb_serial_port *port = urb->context; |
834 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); | 833 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); |
835 | int result; | 834 | int result; |
835 | int status = urb->status; | ||
836 | 836 | ||
837 | switch (urb->status) { | 837 | switch (status) { |
838 | case 0: | 838 | case 0: |
839 | /* success */ | 839 | /* success */ |
840 | break; | 840 | break; |
@@ -843,14 +843,14 @@ static void spcp8x5_write_bulk_callback(struct urb *urb) | |||
843 | case -ESHUTDOWN: | 843 | case -ESHUTDOWN: |
844 | /* this urb is terminated, clean up */ | 844 | /* this urb is terminated, clean up */ |
845 | dev_dbg(&port->dev, "urb shutting down with status: %d\n", | 845 | dev_dbg(&port->dev, "urb shutting down with status: %d\n", |
846 | urb->status); | 846 | status); |
847 | priv->write_urb_in_use = 0; | 847 | priv->write_urb_in_use = 0; |
848 | return; | 848 | return; |
849 | default: | 849 | default: |
850 | /* error in the urb, so we have to resubmit it */ | 850 | /* error in the urb, so we have to resubmit it */ |
851 | dbg("%s - Overflow in write", __func__); | 851 | dbg("%s - Overflow in write", __func__); |
852 | dbg("%s - nonzero write bulk status received: %d", | 852 | dbg("%s - nonzero write bulk status received: %d", |
853 | __func__, urb->status); | 853 | __func__, status); |
854 | port->write_urb->transfer_buffer_length = 1; | 854 | port->write_urb->transfer_buffer_length = 1; |
855 | port->write_urb->dev = port->serial->dev; | 855 | port->write_urb->dev = port->serial->dev; |
856 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 856 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |