]> Pileus Git - ~andy/linux/commitdiff
usb-core: Make usb_free_streams return an error
authorHans de Goede <hdegoede@redhat.com>
Fri, 30 Aug 2013 12:03:59 +0000 (14:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Sep 2013 16:49:24 +0000 (09:49 -0700)
The hcd-driver free_streams method can return an error, so lets properly
propagate that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c
include/linux/usb.h

index 3a2e82a9c115a413fa90f1eb85c9a2d39218d08e..ab54999da2bf72fa12362787c6cedbf9cd77d1d5 100644 (file)
@@ -2075,8 +2075,11 @@ EXPORT_SYMBOL_GPL(usb_alloc_streams);
  *
  * Reverts a group of bulk endpoints back to not using stream IDs.
  * Can fail if we are given bad arguments, or HCD is broken.
+ *
+ * Return: On success, the number of allocated streams. On failure, a negative
+ * error code.
  */
-void usb_free_streams(struct usb_interface *interface,
+int usb_free_streams(struct usb_interface *interface,
                struct usb_host_endpoint **eps, unsigned int num_eps,
                gfp_t mem_flags)
 {
@@ -2087,14 +2090,14 @@ void usb_free_streams(struct usb_interface *interface,
        dev = interface_to_usbdev(interface);
        hcd = bus_to_hcd(dev->bus);
        if (dev->speed != USB_SPEED_SUPER)
-               return;
+               return -EINVAL;
 
        /* Streams only apply to bulk endpoints. */
        for (i = 0; i < num_eps; i++)
                if (!eps[i] || !usb_endpoint_xfer_bulk(&eps[i]->desc))
-                       return;
+                       return -EINVAL;
 
-       hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags);
+       return hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags);
 }
 EXPORT_SYMBOL_GPL(usb_free_streams);
 
index 001629cd1a97b831f2eb448013c114b3a76f0de7..f726c39097e044d2bec294054a42bff87b5c46f7 100644 (file)
@@ -702,7 +702,7 @@ extern int usb_alloc_streams(struct usb_interface *interface,
                unsigned int num_streams, gfp_t mem_flags);
 
 /* Reverts a group of bulk endpoints back to not using stream IDs. */
-extern void usb_free_streams(struct usb_interface *interface,
+extern int usb_free_streams(struct usb_interface *interface,
                struct usb_host_endpoint **eps, unsigned int num_eps,
                gfp_t mem_flags);