diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-11-09 05:59:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-09 07:02:23 -0500 |
commit | d656fa32b13424701bb85f6b5183ea869b363799 (patch) | |
tree | 76cbfb42913ac32bf6d45c1d777c3e4d5b5f41c8 | |
parent | 0c3b34a569f83b281c4c0ef4542cf59d7b186a88 (diff) |
usb: core: message: remember to reset 'ret' to 0 when necessary
usb_control_msg() will return the amount of bytes transferred, if that
amount matches what we wanted to transfer, we need to reset 'ret' to 0
from usb_get_status().
Fixes: 2e43f0fe379c ("usb: core: add a 'type' parameter to usb_get_status()")
Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/core/message.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index ebaea514161f..77001bcfc504 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -975,6 +975,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target, | |||
975 | } | 975 | } |
976 | 976 | ||
977 | *(u32 *) data = le32_to_cpu(*(__le32 *) status); | 977 | *(u32 *) data = le32_to_cpu(*(__le32 *) status); |
978 | ret = 0; | ||
978 | break; | 979 | break; |
979 | case 2: | 980 | case 2: |
980 | if (type != USB_STATUS_TYPE_STANDARD) { | 981 | if (type != USB_STATUS_TYPE_STANDARD) { |
@@ -983,6 +984,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target, | |||
983 | } | 984 | } |
984 | 985 | ||
985 | *(u16 *) data = le16_to_cpu(*(__le16 *) status); | 986 | *(u16 *) data = le16_to_cpu(*(__le16 *) status); |
987 | ret = 0; | ||
986 | break; | 988 | break; |
987 | default: | 989 | default: |
988 | ret = -EIO; | 990 | ret = -EIO; |