net: usb: ax88179_178a: Add check for usbnet_get_endpoints()
authorMa Ke <make_ruc2021@163.com>
Wed, 24 Apr 2024 06:56:34 +0000 (14:56 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 26 Apr 2024 01:57:42 +0000 (18:57 -0700)
To avoid the failure of usbnet_get_endpoints(), we should check the
return value of the usbnet_get_endpoints().

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
Link: https://lore.kernel.org/r/20240424065634.1870027-1-make_ruc2021@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/usb/ax88179_178a.c

index 377be0d..b25535a 100644 (file)
@@ -1286,8 +1286,11 @@ static void ax88179_get_mac_addr(struct usbnet *dev)
 static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
 {
        struct ax88179_data *ax179_data;
+       int ret;
 
-       usbnet_get_endpoints(dev, intf);
+       ret = usbnet_get_endpoints(dev, intf);
+       if (ret < 0)
+               return ret;
 
        ax179_data = kzalloc(sizeof(*ax179_data), GFP_KERNEL);
        if (!ax179_data)