]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
USB: serial: ftdi_sio: don't access latency timer on old chips
authorIan Abbott <abbotti@mev.co.uk>
Wed, 8 Mar 2017 16:02:57 +0000 (16:02 +0000)
committerJohan Hovold <johan@kernel.org>
Mon, 13 Mar 2017 15:13:48 +0000 (16:13 +0100)
The latency timer was introduced with the FT232BM and FT245BM chips.  Do
not bother attempting to read or write it for older chip versions.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ftdi_sio.c

index c540de15aad2c7d301543aef202b3560fb2f7399..72314734dfd0ea516a3174da1a9c860e2bef6267 100644 (file)
@@ -1406,6 +1406,9 @@ static int write_latency_timer(struct usb_serial_port *port)
        int rv;
        int l = priv->latency;
 
+       if (priv->chip_type == SIO || priv->chip_type == FT8U232AM)
+               return -EINVAL;
+
        if (priv->flags & ASYNC_LOW_LATENCY)
                l = 1;
 
@@ -1429,6 +1432,9 @@ static int read_latency_timer(struct usb_serial_port *port)
        unsigned char *buf;
        int rv;
 
+       if (priv->chip_type == SIO || priv->chip_type == FT8U232AM)
+               return -EINVAL;
+
        buf = kmalloc(1, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;