Skip to content

Commit dc89548

Browse files
Yuuoniykuba-moo
authored andcommitted
net: usb: asix_devices: Check return value of usbnet_get_endpoints
The code did not check the return value of usbnet_get_endpoints. Add checks and return the error if it fails to transfer the error. Found via static anlaysis and this is similar to commit 07161b2 ("sr9800: Add check for usbnet_get_endpoints"). Fixes: 933a27d ("USB: asix - Add AX88178 support and many other changes") Fixes: 2e55cc7 ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters") Cc: [email protected] Signed-off-by: Miaoqian Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ac345c5 commit dc89548

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/net/usb/asix_devices.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
230230
int i;
231231
unsigned long gpio_bits = dev->driver_info->data;
232232

233-
usbnet_get_endpoints(dev,intf);
233+
ret = usbnet_get_endpoints(dev, intf);
234+
if (ret)
235+
goto out;
234236

235237
/* Toggle the GPIOs in a manufacturer/model specific way */
236238
for (i = 2; i >= 0; i--) {
@@ -848,7 +850,9 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
848850

849851
dev->driver_priv = priv;
850852

851-
usbnet_get_endpoints(dev, intf);
853+
ret = usbnet_get_endpoints(dev, intf);
854+
if (ret)
855+
return ret;
852856

853857
/* Maybe the boot loader passed the MAC address via device tree */
854858
if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
@@ -1281,7 +1285,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
12811285
int ret;
12821286
u8 buf[ETH_ALEN] = {0};
12831287

1284-
usbnet_get_endpoints(dev,intf);
1288+
ret = usbnet_get_endpoints(dev, intf);
1289+
if (ret)
1290+
return ret;
12851291

12861292
/* Get the MAC address */
12871293
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);

0 commit comments

Comments
 (0)