Commit ff399bab authored by Wei Chen's avatar Wei Chen Committed by Greg Kroah-Hartman

usb: gadget: legacy: fix error return code in gfs_bind

We must return negative error code -ENOMEM if function
'usb_otg_descriptor_alloc()' fails.
Signed-off-by: default avatarWei Chen <harperchen1110@gmail.com>
Link: https://lore.kernel.org/r/20230621124323.47183-1-harperchen1110@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef1e29c6
......@@ -389,8 +389,10 @@ static int gfs_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) {
ret = -ENOMEM;
goto error_rndis;
}
usb_otg_descriptor_init(cdev->gadget, usb_desc);
gfs_otg_desc[0] = usb_desc;
gfs_otg_desc[1] = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment