USB: core: return -EREMOTEIO on short usb_control_msg_recv()

Return -EREMOTEIO instead of -EINVAL on short control transfers when
using the new usb_control_msg_recv() helper.

EINVAL is used to report invalid arguments (e.g. to the helper) and
should not be used for unrelated errors.

Many driver currently return -EIO on short control transfers but since
host-controller drivers already use -EREMOTEIO for short transfers
whenever the URB_SHORT_NOT_OK flag is set, let's use that here as well.

This also allows usb_control_msg_recv() to eventually use
URB_SHORT_NOT_OK without changing the return value again.

Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20201204085110.20055-4-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Johan Hovold 2020-12-04 09:51:10 +01:00 committed by Greg Kroah-Hartman
parent baf7df456b
commit 9dc9c8543a
1 changed files with 1 additions and 1 deletions

View File

@ -289,7 +289,7 @@ int usb_control_msg_recv(struct usb_device *dev, __u8 endpoint, __u8 request,
memcpy(driver_data, data, size);
ret = 0;
} else {
ret = -EINVAL;
ret = -EREMOTEIO;
}
exit: