diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2020-05-03 12:47:07 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-20 08:15:42 +0200 |
commit | 3fa699ebae128e7ac68e3202cb3195017ee8fc7c (patch) | |
tree | 8169195a0bfc8eb8219ad71efdeb9084a0ce51cb /drivers/usb/gadget/legacy/audio.c | |
parent | a1e63dd3d6ba30fadcb51169593da6566c9e8bfd (diff) | |
download | linux-stable-3fa699ebae128e7ac68e3202cb3195017ee8fc7c.tar.gz linux-stable-3fa699ebae128e7ac68e3202cb3195017ee8fc7c.tar.bz2 linux-stable-3fa699ebae128e7ac68e3202cb3195017ee8fc7c.zip |
usb: gadget: audio: Fix a missing error return value in audio_bind()
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>
Diffstat (limited to 'drivers/usb/gadget/legacy/audio.c')
-rw-r--r-- | drivers/usb/gadget/legacy/audio.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c index 5d7b3c6a422b..f61936b8baaf 100644 --- a/drivers/usb/gadget/legacy/audio.c +++ b/drivers/usb/gadget/legacy/audio.c @@ -249,8 +249,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; |