Skip to content

Commit

Permalink
usbnet: fix failure handling in usbnet_probe
Browse files Browse the repository at this point in the history
If register_netdev returns failure, the dev->interrupt and
its transfer buffer should be released, so just fix it.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
tom.leiming@gmail.com authored and David S. Miller committed May 3, 2012
1 parent 720f3d7 commit a472384
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/usb/usbnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)

status = register_netdev (net);
if (status)
goto out3;
goto out4;
netif_info(dev, probe, dev->net,
"register '%s' at usb-%s-%s, %s, %pM\n",
udev->dev.driver->name,
Expand All @@ -1462,6 +1462,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)

return 0;

out4:
usb_free_urb(dev->interrupt);
out3:
if (info->unbind)
info->unbind (dev, udev);
Expand Down

0 comments on commit a472384

Please sign in to comment.