diff options
author | Wei Chen <harperchen1110@gmail.com> | 2023-06-21 12:43:23 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-06-21 18:08:07 +0200 |
commit | ff399bab86382c896c3922a570884bba287eb465 (patch) | |
tree | 0bfc759bd3b943872df41a101b961afe4bf496e8 /drivers/usb | |
parent | ef1e29c6f6ad1e327d07b078e37a1eddd832e8e4 (diff) | |
download | linux-ff399bab86382c896c3922a570884bba287eb465.tar.gz linux-ff399bab86382c896c3922a570884bba287eb465.tar.bz2 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.c | 4 |
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; |