aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ftdi_sio.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2009-12-24 06:42:08 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:53:37 -0500
commit54f328d0c7221675e3c1647e1918172fec1b92c9 (patch)
treea1889ca6d43c135d627e77c54d32f80d20eb5174 /drivers/usb/serial/ftdi_sio.c
parent4357369d024c709d91864af88f02d7ac08d0f470 (diff)
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/usb/serial/ftdi_sio.c')
-rw-r--r--drivers/usb/serial/ftdi_sio.c14
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)
1181{ 1181{
1182 struct ftdi_private *priv = usb_get_serial_port_data(port); 1182 struct ftdi_private *priv = usb_get_serial_port_data(port);
1183 struct usb_device *udev = port->serial->dev; 1183 struct usb_device *udev = port->serial->dev;
1184 unsigned short latency = 0; 1184 unsigned char *buf;
1185 int rv = 0; 1185 int rv = 0;
1186 1186
1187 dbg("%s", __func__); 1187 dbg("%s", __func__);
1188 1188
1189 buf = kmalloc(1, GFP_KERNEL);
1190 if (!buf)
1191 return -ENOMEM;
1192
1189 rv = usb_control_msg(udev, 1193 rv = usb_control_msg(udev,
1190 usb_rcvctrlpipe(udev, 0), 1194 usb_rcvctrlpipe(udev, 0),
1191 FTDI_SIO_GET_LATENCY_TIMER_REQUEST, 1195 FTDI_SIO_GET_LATENCY_TIMER_REQUEST,
1192 FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, 1196 FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
1193 0, priv->interface, 1197 0, priv->interface,
1194 (char *) &latency, 1, WDR_TIMEOUT); 1198 buf, 1, WDR_TIMEOUT);
1195
1196 if (rv < 0) 1199 if (rv < 0)
1197 dev_err(&port->dev, "Unable to read latency timer: %i\n", rv); 1200 dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
1198 else 1201 else
1199 priv->latency = latency; 1202 priv->latency = buf[0];
1203
1204 kfree(buf);
1205
1200 return rv; 1206 return rv;
1201} 1207}
1202 1208