diff options
author | Johan Hovold <jhovold@gmail.com> | 2009-12-24 12:42:08 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 14:53:37 -0800 |
commit | 54f328d0c7221675e3c1647e1918172fec1b92c9 (patch) | |
tree | a1889ca6d43c135d627e77c54d32f80d20eb5174 /drivers | |
parent | 4357369d024c709d91864af88f02d7ac08d0f470 (diff) | |
download | lwn-54f328d0c7221675e3c1647e1918172fec1b92c9.tar.gz lwn-54f328d0c7221675e3c1647e1918172fec1b92c9.zip |
USB: ftdi_sio: fix latency-timeout endianess bug
Also fixes DMA transfer to stack for latency buffer.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ec901ed5d93c..59b6cbf020a0 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1181,22 +1181,28 @@ static int read_latency_timer(struct usb_serial_port *port) { struct ftdi_private *priv = usb_get_serial_port_data(port); struct usb_device *udev = port->serial->dev; - unsigned short latency = 0; + unsigned char *buf; int rv = 0; dbg("%s", __func__); + buf = kmalloc(1, GFP_KERNEL); + if (!buf) + return -ENOMEM; + rv = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), FTDI_SIO_GET_LATENCY_TIMER_REQUEST, FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, 0, priv->interface, - (char *) &latency, 1, WDR_TIMEOUT); - + buf, 1, WDR_TIMEOUT); if (rv < 0) dev_err(&port->dev, "Unable to read latency timer: %i\n", rv); else - priv->latency = latency; + priv->latency = buf[0]; + + kfree(buf); + return rv; } |