]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
usb: usb_control_msg() propagate controller error code
authorHans de Goede <hdegoede@redhat.com>
Sun, 10 May 2015 12:10:14 +0000 (14:10 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:39:38 +0000 (22:39 +0200)
Propagate the error returned by submit_control_msg() rather then always
returning -EIO when the hcd code indicates an error.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
common/usb.c

index 1b26bfab367d2675a2dcc79bc62e81cc66762714..20c614cbcb089eda65f2d9eff4ee61462780535c 100644 (file)
@@ -192,6 +192,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
                        void *data, unsigned short size, int timeout)
 {
        ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet, 1);
+       int err;
 
        if ((timeout == 0) && (!asynch_allowed)) {
                /* request for a asynch control pipe is not allowed */
@@ -209,8 +210,9 @@ 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 */
 
-       if (submit_control_msg(dev, pipe, data, size, setup_packet) < 0)
-               return -EIO;
+       err = submit_control_msg(dev, pipe, data, size, setup_packet);
+       if (err < 0)
+               return err;
        if (timeout == 0)
                return (int)size;