diff options
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 1ac7e802b4b6..c2ac129557aa 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1808,7 +1808,7 @@ static void ftdi_read_bulk_callback(struct urb *urb) | |||
1808 | if (port->port.count <= 0) | 1808 | if (port->port.count <= 0) |
1809 | return; | 1809 | return; |
1810 | 1810 | ||
1811 | tty = port->port.tty; | 1811 | tty = tty_port_tty_get(&port->port); |
1812 | if (!tty) { | 1812 | if (!tty) { |
1813 | dbg("%s - bad tty pointer - exiting", __func__); | 1813 | dbg("%s - bad tty pointer - exiting", __func__); |
1814 | return; | 1814 | return; |
@@ -1817,7 +1817,7 @@ static void ftdi_read_bulk_callback(struct urb *urb) | |||
1817 | priv = usb_get_serial_port_data(port); | 1817 | priv = usb_get_serial_port_data(port); |
1818 | if (!priv) { | 1818 | if (!priv) { |
1819 | dbg("%s - bad port private data pointer - exiting", __func__); | 1819 | dbg("%s - bad port private data pointer - exiting", __func__); |
1820 | return; | 1820 | goto out; |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | if (urb != port->read_urb) | 1823 | if (urb != port->read_urb) |
@@ -1827,7 +1827,7 @@ static void ftdi_read_bulk_callback(struct urb *urb) | |||
1827 | /* This will happen at close every time so it is a dbg not an | 1827 | /* This will happen at close every time so it is a dbg not an |
1828 | err */ | 1828 | err */ |
1829 | dbg("(this is ok on close) nonzero read bulk status received: %d", status); | 1829 | dbg("(this is ok on close) nonzero read bulk status received: %d", status); |
1830 | return; | 1830 | goto out; |
1831 | } | 1831 | } |
1832 | 1832 | ||
1833 | /* count data bytes, but not status bytes */ | 1833 | /* count data bytes, but not status bytes */ |
@@ -1838,7 +1838,8 @@ static void ftdi_read_bulk_callback(struct urb *urb) | |||
1838 | spin_unlock_irqrestore(&priv->rx_lock, flags); | 1838 | spin_unlock_irqrestore(&priv->rx_lock, flags); |
1839 | 1839 | ||
1840 | ftdi_process_read(&priv->rx_work.work); | 1840 | ftdi_process_read(&priv->rx_work.work); |
1841 | 1841 | out: | |
1842 | tty_kref_put(tty); | ||
1842 | } /* ftdi_read_bulk_callback */ | 1843 | } /* ftdi_read_bulk_callback */ |
1843 | 1844 | ||
1844 | 1845 | ||
@@ -1863,7 +1864,7 @@ static void ftdi_process_read(struct work_struct *work) | |||
1863 | if (port->port.count <= 0) | 1864 | if (port->port.count <= 0) |
1864 | return; | 1865 | return; |
1865 | 1866 | ||
1866 | tty = port->port.tty; | 1867 | tty = tty_port_tty_get(&port->port); |
1867 | if (!tty) { | 1868 | if (!tty) { |
1868 | dbg("%s - bad tty pointer - exiting", __func__); | 1869 | dbg("%s - bad tty pointer - exiting", __func__); |
1869 | return; | 1870 | return; |
@@ -1872,13 +1873,13 @@ static void ftdi_process_read(struct work_struct *work) | |||
1872 | priv = usb_get_serial_port_data(port); | 1873 | priv = usb_get_serial_port_data(port); |
1873 | if (!priv) { | 1874 | if (!priv) { |
1874 | dbg("%s - bad port private data pointer - exiting", __func__); | 1875 | dbg("%s - bad port private data pointer - exiting", __func__); |
1875 | return; | 1876 | goto out; |
1876 | } | 1877 | } |
1877 | 1878 | ||
1878 | urb = port->read_urb; | 1879 | urb = port->read_urb; |
1879 | if (!urb) { | 1880 | if (!urb) { |
1880 | dbg("%s - bad read_urb pointer - exiting", __func__); | 1881 | dbg("%s - bad read_urb pointer - exiting", __func__); |
1881 | return; | 1882 | goto out; |
1882 | } | 1883 | } |
1883 | 1884 | ||
1884 | data = urb->transfer_buffer; | 1885 | data = urb->transfer_buffer; |
@@ -2020,7 +2021,7 @@ static void ftdi_process_read(struct work_struct *work) | |||
2020 | schedule_delayed_work(&priv->rx_work, 1); | 2021 | schedule_delayed_work(&priv->rx_work, 1); |
2021 | else | 2022 | else |
2022 | dbg("%s - port is closed", __func__); | 2023 | dbg("%s - port is closed", __func__); |
2023 | return; | 2024 | goto out; |
2024 | } | 2025 | } |
2025 | 2026 | ||
2026 | /* urb is completely processed */ | 2027 | /* urb is completely processed */ |
@@ -2041,6 +2042,8 @@ static void ftdi_process_read(struct work_struct *work) | |||
2041 | err("%s - failed resubmitting read urb, error %d", | 2042 | err("%s - failed resubmitting read urb, error %d", |
2042 | __func__, result); | 2043 | __func__, result); |
2043 | } | 2044 | } |
2045 | out: | ||
2046 | tty_kref_put(tty); | ||
2044 | } /* ftdi_process_read */ | 2047 | } /* ftdi_process_read */ |
2045 | 2048 | ||
2046 | 2049 | ||