mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-08 21:53:54 +08:00
staging: rtl8712: add error handler in r8712_usbctrl_vendorreq()
When 'status' returned from usb_control_msg() is not equal to 'len', that usb_control_msg() is on partial failure, r8712_usbctrl_vendorreq() will treat partial reads as success. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Wang Cheng <wanngchenng@gmail.com> Link: https://lore.kernel.org/r/e33ea53d36c422fbe7eabec5bd9eecb0ebce1bc5.1652618244.git.wanngchenng@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ea32366a8f
commit
644ee3bff4
@ -495,14 +495,21 @@ int r8712_usbctrl_vendorreq(struct intf_priv *pintfpriv, u8 request, u16 value,
|
||||
}
|
||||
status = usb_control_msg(udev, pipe, request, reqtype, value, index,
|
||||
pIo_buf, len, 500);
|
||||
if (status > 0) { /* Success this control transfer. */
|
||||
if (requesttype == 0x01) {
|
||||
/* For Control read transfer, we have to copy the read
|
||||
* data from pIo_buf to pdata.
|
||||
*/
|
||||
memcpy(pdata, pIo_buf, status);
|
||||
}
|
||||
if (status < 0)
|
||||
goto free;
|
||||
if (status != len) {
|
||||
status = -EREMOTEIO;
|
||||
goto free;
|
||||
}
|
||||
/* Success this control transfer. */
|
||||
if (requesttype == 0x01) {
|
||||
/* For Control read transfer, we have to copy the read
|
||||
* data from pIo_buf to pdata.
|
||||
*/
|
||||
memcpy(pdata, pIo_buf, status);
|
||||
}
|
||||
|
||||
free:
|
||||
kfree(palloc_buf);
|
||||
return status;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user