Skip to content

Commit

Permalink
USB: gadget: legacy: fix return error code in acm_ms_bind()
Browse files Browse the repository at this point in the history
If usb_otg_descriptor_alloc() failed, it need return ENOMEM.

Fixes: 578aa8a ("usb: gadget: acm_ms: allocate and init otg descriptor by otg capabilities")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Yang Yingliang <[email protected]>
Cc: stable <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Yang Yingliang authored and gregkh committed Dec 28, 2020
1 parent 5cc35c2 commit c91d3a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/gadget/legacy/acm_ms.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ static int acm_ms_bind(struct usb_composite_dev *cdev)
struct usb_descriptor_header *usb_desc;

usb_desc = usb_otg_descriptor_alloc(gadget);
if (!usb_desc)
if (!usb_desc) {
status = -ENOMEM;
goto fail_string_ids;
}
usb_otg_descriptor_init(gadget, usb_desc);
otg_desc[0] = usb_desc;
otg_desc[1] = NULL;
Expand Down

0 comments on commit c91d3a6

Please sign in to comment.