usb: gadget: uvc: Fix return value in case of error
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 16 Jul 2016 07:04:40 +0000 (09:04 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 11 Aug 2016 12:09:46 +0000 (15:09 +0300)
If this memory allocation fail, we will return 0, which means success.
Return -ENOMEM instead.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/uvc_configfs.c

index 66753ba7a42eb803e64964c6a4a470dad6391242..31125a4a2658938cdc67ef4b24ee9bfbfeeadf44 100644 (file)
@@ -2023,7 +2023,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src,
        if (!data) {
                kfree(*class_array);
                *class_array = NULL;
-               ret = PTR_ERR(data);
+               ret = -ENOMEM;
                goto unlock;
        }
        cl_arr = *class_array;