[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201117092955.4102785-1-yangyingliang@huawei.com>
Date: Tue, 17 Nov 2020 17:29:55 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <gregkh@...uxfoundation.org>, <yangyingliang@...wei.com>
Subject: [PATCH] USB: gadget: legacy: fix return error code in acm_ms_bind()
If usb_otg_descriptor_alloc() failed, it need return ENOMEM.
Fixes: 578aa8a2b12c ("usb: gadget: acm_ms: allocate and init otg descriptor by otg capabilities")
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/usb/gadget/legacy/acm_ms.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c
index 59be2d8417c9..e8033e5f0c18 100644
--- a/drivers/usb/gadget/legacy/acm_ms.c
+++ b/drivers/usb/gadget/legacy/acm_ms.c
@@ -200,8 +200,10 @@ static int acm_ms_bind(struct usb_composite_dev *cdev)
struct usb_descriptor_header *usb_desc;
usb_desc = usb_otg_descriptor_alloc(gadget);
- if (!usb_desc)
+ if (!usb_desc) {
+ status = -ENOMEM;
goto fail_string_ids;
+ }
usb_otg_descriptor_init(gadget, usb_desc);
otg_desc[0] = usb_desc;
otg_desc[1] = NULL;
--
2.25.1
Powered by blists - more mailing lists