From: Johan Hovold <jhovold@gmail.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Matti Aarnio <matti.aarnio@zmailer.org>,
Johan Hovold <jhovold@gmail.com>
Subject: [PATCH 2/5] USB: ftdi_sio: fix latency-timeout endianess bug
Date: Thu, 24 Dec 2009 12:42:08 +0100 [thread overview]
Message-ID: <1261654931-31543-3-git-send-email-jhovold@gmail.com> (raw)
In-Reply-To: <1261654931-31543-1-git-send-email-jhovold@gmail.com>
Also fixes DMA transfer to stack for latency buffer.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
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 a952a3a..6d191fb 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1162,22 +1162,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;
}
--
1.6.6.rc4
next prev parent reply other threads:[~2009-12-24 11:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-24 11:42 USB: ftdi_sio: two bug fixes and some clean up Johan Hovold
2009-12-24 11:42 ` [PATCH 1/5] USB: ftdi_sio: use error code from usb stack in read_latency_timer Johan Hovold
2009-12-24 11:42 ` Johan Hovold [this message]
2009-12-24 12:13 ` [PATCH 2/5] USB: ftdi_sio: fix latency-timeout endianess bug Andreas Mohr
2009-12-24 11:42 ` [PATCH 3/5] USB: ftdi_sio: fix DMA buffers on stack Johan Hovold
2009-12-24 11:42 ` [PATCH 4/5] USB: ftdi_sio: clean up modem status handling Johan Hovold
2009-12-24 11:42 ` [PATCH 5/5] USB: ftdi_sio: remove unnecessary initialisations Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1261654931-31543-3-git-send-email-jhovold@gmail.com \
--to=jhovold@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=matti.aarnio@zmailer.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®