Skip to content

Commit d656fa3

Browse files
Felipe Balbigregkh
authored andcommitted
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: 2e43f0f ("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>
1 parent 0c3b34a commit d656fa3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/usb/core/message.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target,
975975
}
976976

977977
*(u32 *) data = le32_to_cpu(*(__le32 *) status);
978+
ret = 0;
978979
break;
979980
case 2:
980981
if (type != USB_STATUS_TYPE_STANDARD) {
@@ -983,6 +984,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target,
983984
}
984985

985986
*(u16 *) data = le16_to_cpu(*(__le16 *) status);
987+
ret = 0;
986988
break;
987989
default:
988990
ret = -EIO;

0 commit comments

Comments
 (0)