[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230621124323.47183-1-harperchen1110@gmail.com>
Date: Wed, 21 Jun 2023 12:43:23 +0000
From: Wei Chen <harperchen1110@...il.com>
To: gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Wei Chen <harperchen1110@...il.com>
Subject: [PATCH] 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@...il.com>
---
drivers/usb/gadget/legacy/g_ffs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c
index ae6d8f7092b8..4592df5e2ea1 100644
--- a/drivers/usb/gadget/legacy/g_ffs.c
+++ b/drivers/usb/gadget/legacy/g_ffs.c
@@ -395,8 +395,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;
--
2.25.1
Powered by blists - more mailing lists