]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: usb: set error code when usb_alloc_urb fails
authorPan Bian <bianpan2016@163.com>
Sat, 3 Dec 2016 11:24:48 +0000 (19:24 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Dec 2016 18:27:15 +0000 (13:27 -0500)
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=188771

Signed-off-by: Pan Bian <bianpan2016@163.com>
Acked-by: Woojung Huh <woojung.huh@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/lan78xx.c

index db558b8b32fe5ba7f9fb71129d41cf806b6c08f4..f33460cec79f394238e8f489453d19d722245009 100644 (file)
@@ -3395,6 +3395,7 @@ static int lan78xx_probe(struct usb_interface *intf,
        if (buf) {
                dev->urb_intr = usb_alloc_urb(0, GFP_KERNEL);
                if (!dev->urb_intr) {
+                       ret = -ENOMEM;
                        kfree(buf);
                        goto out3;
                } else {