[PATCH 220/229] USB: ir-usb: fix incorrect write-buffer length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johan Hovold <jhovold@xxxxxxxxx>

Returned length should include header length.

Signed-off-by: Johan Hovold <jhovold@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/usb/serial/ir-usb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index e7087f9..ccbce40 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -307,6 +307,7 @@ static int ir_prepare_write_buffer(struct usb_serial_port *port,
 						void *dest, size_t size)
 {
 	unsigned char *buf = dest;
+	int count;
 
 	/*
 	 * 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,
 	 */
 	*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);
+	return count + 1;
 }
 
 static void ir_process_read_urb(struct urb *urb)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux