summaryrefslogtreecommitdiff
path: root/common/usb.c
diff options
context:
space:
mode:
authorIlya Yanok <ilya.yanok@cogentembedded.com>2012-07-15 04:43:51 +0000
committerMarek Vasut <marex@denx.de>2012-07-18 14:43:42 +0200
commitfd06028df8a3b48575c9578aa73ab507d451bbc1 (patch)
tree609e199d5da2a8e582489fa7077d0d9eaa746393 /common/usb.c
parent80ab414afdc9543686d8258dd7b933a410df3c4e (diff)
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: Ilya Yanok <ilya.yanok@cogentembedded.com>
Diffstat (limited to 'common/usb.c')
-rw-r--r--common/usb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/usb.c b/common/usb.c
index 46f4741690..1b40228b28 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -188,7 +188,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
request, requesttype, value, index, size);
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)
return (int)size;
@@ -220,7 +221,8 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
if (len < 0)
return -1;
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--) {
if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
break;