Commit 5494ebdf authored by Rupesh Gujare's avatar Rupesh Gujare Committed by Greg Kroah-Hartman

staging: ozwpan: Return correct actual_length to userland

This fixes issue where wrong retrun value was received
by userland application after writing data to raw hid device.
Signed-off-by: default avatarRupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24168911
...@@ -933,13 +933,14 @@ void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data, ...@@ -933,13 +933,14 @@ void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data,
} else { } else {
int copy_len; int copy_len;
oz_trace("VENDOR-CLASS - cnf\n"); oz_trace("VENDOR-CLASS - cnf\n");
if (data_len <= urb->transfer_buffer_length) if (data_len) {
copy_len = data_len; if (data_len <= urb->transfer_buffer_length)
else copy_len = data_len;
copy_len = urb->transfer_buffer_length; else
if (copy_len) copy_len = urb->transfer_buffer_length;
memcpy(urb->transfer_buffer, data, copy_len); memcpy(urb->transfer_buffer, data, copy_len);
urb->actual_length = copy_len; urb->actual_length = copy_len;
}
oz_complete_urb(hcd, urb, 0, 0); oz_complete_urb(hcd, urb, 0, 0);
} }
} }
...@@ -1517,6 +1518,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, ...@@ -1517,6 +1518,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
int data_len = 0; int data_len = 0;
if ((setup->bRequestType & USB_DIR_IN) == 0) if ((setup->bRequestType & USB_DIR_IN) == 0)
data_len = wlength; data_len = wlength;
urb->actual_length = data_len;
if (oz_usb_control_req(port->hpd, req_id, setup, if (oz_usb_control_req(port->hpd, req_id, setup,
urb->transfer_buffer, data_len)) { urb->transfer_buffer, data_len)) {
rc = -ENOMEM; rc = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment