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: Wei Chen <harperchen1110@gmail.com> Link: https://lore.kernel.org/r/20230621124323.47183-1-harperchen1110@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ef1e29c6f6
commit
ff399bab86
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue