summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorWei Chen <harperchen1110@gmail.com>2023-06-21 14:43:23 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-21 18:08:07 +0200
commitff399bab86382c896c3922a570884bba287eb465 (patch)
tree0bfc759bd3b943872df41a101b961afe4bf496e8 /drivers/usb
parentusb: typec: fsa4480: add support for Audio Accessory Mode (diff)
downloadlinux-ff399bab86382c896c3922a570884bba287eb465.tar.xz
linux-ff399bab86382c896c3922a570884bba287eb465.zip
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/legacy/g_ffs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c
index 097854683e5b..a9544fea8723 100644
--- a/drivers/usb/gadget/legacy/g_ffs.c
+++ b/drivers/usb/gadget/legacy/g_ffs.c
@@ -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;