提交 fd06028d 编写于 作者: I Ilya Yanok 提交者: Marek Vasut

usb: check return value of submit_{control, bulk}_msg

Return values of submit_{control,bulk}_msg() functions
should be checked to detect possible error.
Signed-off-by: NIlya Yanok <ilya.yanok@cogentembedded.com>
上级 80ab414a
...@@ -188,7 +188,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, ...@@ -188,7 +188,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
request, requesttype, value, index, size); request, requesttype, value, index, size);
dev->status = USB_ST_NOT_PROC; /*not yet processed */ dev->status = USB_ST_NOT_PROC; /*not yet processed */
submit_control_msg(dev, pipe, data, size, setup_packet); if (submit_control_msg(dev, pipe, data, size, setup_packet) < 0)
return -1;
if (timeout == 0) if (timeout == 0)
return (int)size; return (int)size;
...@@ -220,7 +221,8 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe, ...@@ -220,7 +221,8 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
if (len < 0) if (len < 0)
return -1; return -1;
dev->status = USB_ST_NOT_PROC; /*not yet processed */ dev->status = USB_ST_NOT_PROC; /*not yet processed */
submit_bulk_msg(dev, pipe, data, len); if (submit_bulk_msg(dev, pipe, data, len) < 0)
return -1;
while (timeout--) { while (timeout--) {
if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC)) if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册