Skip to content

Commit

Permalink
usb: core: message: remember to reset 'ret' to 0 when necessary
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Nov 9, 2017
1 parent 0c3b34a commit d656fa3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target,
}

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

*(u16 *) data = le16_to_cpu(*(__le16 *) status);
ret = 0;
break;
default:
ret = -EIO;
Expand Down

0 comments on commit d656fa3

Please sign in to comment.