提交 42601e35 编写于 作者: J Junlin Yang 提交者: Greg Kroah-Hartman

usb: class: cdc-wdm: return the correct errno code

The "rv" is initialized to "-ENOMEM", because "rv" is re-assigned to
"-EINVAL", when kmalloc & usb_alloc_urb failed, the return value should
return "-ENOMEM" rather than "-EINVAL",so the "rv" assignment is placed
in the position where usb_endpoint_is_int_in is false.
Acked-by: NOliver Neukum <oneukum@suse.com>
Signed-off-by: NJunlin Yang <yangjunlin@yulong.com>
Link: https://lore.kernel.org/r/20210621132415.2341-1-angkery@163.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 8e9910c5
......@@ -868,9 +868,10 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
INIT_WORK(&desc->rxwork, wdm_rxwork);
INIT_WORK(&desc->service_outs_intr, service_interrupt_work);
rv = -EINVAL;
if (!usb_endpoint_is_int_in(ep))
if (!usb_endpoint_is_int_in(ep)) {
rv = -EINVAL;
goto err;
}
desc->wMaxPacketSize = usb_endpoint_maxp(ep);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册