提交 e421fe97 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: ir-usb: fix incorrect write-buffer length

Returned length should include header length.
Signed-off-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 f26c2889
...@@ -307,6 +307,7 @@ static int ir_prepare_write_buffer(struct usb_serial_port *port, ...@@ -307,6 +307,7 @@ static int ir_prepare_write_buffer(struct usb_serial_port *port,
void *dest, size_t size) void *dest, size_t size)
{ {
unsigned char *buf = dest; unsigned char *buf = dest;
int count;
/* /*
* The first byte of the packet we send to the device contains an * The first byte of the packet we send to the device contains an
...@@ -317,8 +318,9 @@ static int ir_prepare_write_buffer(struct usb_serial_port *port, ...@@ -317,8 +318,9 @@ static int ir_prepare_write_buffer(struct usb_serial_port *port,
*/ */
*buf = ir_xbof | ir_baud; *buf = ir_xbof | ir_baud;
return kfifo_out_locked(&port->write_fifo, buf + 1, size - 1, count = kfifo_out_locked(&port->write_fifo, buf + 1, size - 1,
&port->lock); &port->lock);
return count + 1;
} }
static void ir_process_read_urb(struct urb *urb) static void ir_process_read_urb(struct urb *urb)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册