]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
usb: gadget: audio: Fix a missing error return value in audio_bind()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 3 May 2020 10:47:07 +0000 (12:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 May 2020 06:17:17 +0000 (08:17 +0200)
commit 19b94c1f9c9a16d41a8de3ccbdb8536cf1aecdbf upstream.

If 'usb_otg_descriptor_alloc()' fails, we must return an error code, not 0.

Fixes: 56023ce0fd70 ("usb: gadget: audio: allocate and init otg descriptor by otg capabilities")
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/legacy/audio.c

index 1f5cdbe162df7d69d2ffc66466905bdb0dedf0ba..2ce6e52b505bd3e9fed209b58eae5319152f654a 100644 (file)
@@ -303,8 +303,10 @@ static int audio_bind(struct usb_composite_dev *cdev)
                struct usb_descriptor_header *usb_desc;
 
                usb_desc = usb_otg_descriptor_alloc(cdev->gadget);
-               if (!usb_desc)
+               if (!usb_desc) {
+                       status = -ENOMEM;
                        goto fail;
+               }
                usb_otg_descriptor_init(cdev->gadget, usb_desc);
                otg_desc[0] = usb_desc;
                otg_desc[1] = NULL;