提交 3b486109 编写于 作者: W Wei Yongjun 提交者: Yang Yingliang

usb: gadget: legacy: fix error return code in cdc_bind()

commit e8f7f9e3499a6d96f7f63a4818dc7d0f45a7783b upstream.

If 'usb_otg_descriptor_alloc()' fails, we must return a
negative error code -ENOMEM, not 0.

Fixes: ab6796ae ("usb: gadget: cdc2: allocate and init otg descriptor by otg capabilities")
Reported-by: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NFelipe Balbi <balbi@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 d18b8332
...@@ -179,8 +179,10 @@ static int cdc_bind(struct usb_composite_dev *cdev) ...@@ -179,8 +179,10 @@ static int cdc_bind(struct usb_composite_dev *cdev)
struct usb_descriptor_header *usb_desc; struct usb_descriptor_header *usb_desc;
usb_desc = usb_otg_descriptor_alloc(gadget); usb_desc = usb_otg_descriptor_alloc(gadget);
if (!usb_desc) if (!usb_desc) {
status = -ENOMEM;
goto fail1; goto fail1;
}
usb_otg_descriptor_init(gadget, usb_desc); usb_otg_descriptor_init(gadget, usb_desc);
otg_desc[0] = usb_desc; otg_desc[0] = usb_desc;
otg_desc[1] = NULL; otg_desc[1] = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册