* [PATCH] usb: gadget: audio: Fix a missing error return value in audio_bind()
@ 2020-05-03 10:47 Christophe JAILLET
2020-05-06 9:03 ` Peter Chen
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2020-05-03 10:47 UTC (permalink / raw)
To: balbi, gregkh, jun.li, rogerq
Cc: linux-usb, linux-kernel, kernel-janitors, Christophe JAILLET
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")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/usb/gadget/legacy/audio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c
index dd81fd538cb8..a748ed0842e8 100644
--- a/drivers/usb/gadget/legacy/audio.c
+++ b/drivers/usb/gadget/legacy/audio.c
@@ -300,8 +300,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;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: gadget: audio: Fix a missing error return value in audio_bind()
2020-05-03 10:47 [PATCH] usb: gadget: audio: Fix a missing error return value in audio_bind() Christophe JAILLET
@ 2020-05-06 9:03 ` Peter Chen
0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen @ 2020-05-06 9:03 UTC (permalink / raw)
To: Christophe JAILLET
Cc: balbi, gregkh, jun.li, rogerq, linux-usb, linux-kernel, kernel-janitors
On 20-05-03 12:47:07, Christophe JAILLET wrote:
> 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")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/usb/gadget/legacy/audio.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c
> index dd81fd538cb8..a748ed0842e8 100644
> --- a/drivers/usb/gadget/legacy/audio.c
> +++ b/drivers/usb/gadget/legacy/audio.c
> @@ -300,8 +300,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;
> --
> 2.25.1
>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
--
Thanks,
Peter Chen
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-06 9:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-03 10:47 [PATCH] usb: gadget: audio: Fix a missing error return value in audio_bind() Christophe JAILLET
2020-05-06 9:03 ` Peter Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).