提交 d656fa32 编写于 作者: F Felipe Balbi 提交者: Greg Kroah-Hartman

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: 2e43f0fe ("usb: core: add a 'type' parameter to usb_get_status()")
Reported-by: NTony Lindgren <tony@atomide.com>
Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0c3b34a5
...@@ -975,6 +975,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target, ...@@ -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); *(u32 *) data = le32_to_cpu(*(__le32 *) status);
ret = 0;
break; break;
case 2: case 2:
if (type != USB_STATUS_TYPE_STANDARD) { 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,6 +984,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target,
} }
*(u16 *) data = le16_to_cpu(*(__le16 *) status); *(u16 *) data = le16_to_cpu(*(__le16 *) status);
ret = 0;
break; break;
default: default:
ret = -EIO; ret = -EIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册