]> git.sur5r.net Git - u-boot/commitdiff
usb: check return value of submit_{control, bulk}_msg
authorIlya Yanok <ilya.yanok@cogentembedded.com>
Sun, 15 Jul 2012 04:43:51 +0000 (04:43 +0000)
committerMarek Vasut <marex@denx.de>
Wed, 18 Jul 2012 12:43:42 +0000 (14:43 +0200)
Return values of submit_{control,bulk}_msg() functions
should be checked to detect possible error.

Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
common/usb.c

index 46f47416904afaec76859dcc44c9b8b661116523..1b40228b28836697b5cb4715dd269a21c995ac3e 100644 (file)
@@ -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;