提交 51920830 编写于 作者: P Pan Bian 提交者: David S. Miller

net: usb: set error code when usb_alloc_urb fails

In function lan78xx_probe(), variable ret takes the errno code on
failures. However, when the call to usb_alloc_urb() fails, its value
will keeps 0. 0 indicates success in the context, which is inconsistent
with the execution result. This patch fixes the bug, assigning
"-ENOMEM" to ret when usb_alloc_urb() returns a NULL pointer.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188771Signed-off-by: NPan Bian <bianpan2016@163.com>
Acked-by: NWoojung Huh <woojung.huh@microchip.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b5958963
...@@ -3395,6 +3395,7 @@ static int lan78xx_probe(struct usb_interface *intf, ...@@ -3395,6 +3395,7 @@ static int lan78xx_probe(struct usb_interface *intf,
if (buf) { if (buf) {
dev->urb_intr = usb_alloc_urb(0, GFP_KERNEL); dev->urb_intr = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->urb_intr) { if (!dev->urb_intr) {
ret = -ENOMEM;
kfree(buf); kfree(buf);
goto out3; goto out3;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册