summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2017-02-04 16:56:56 +0000
committerDavid S. Miller <davem@davemloft.net>2017-02-07 10:07:02 -0500
commitd41149145f98fe26dcd0bfd1d6cc095e6e041418 (patch)
tree56f22cbffc15621f95022f22d2f1ee43d8ca8ca4 /drivers/net
parent7926aff5c57b577ab0f43364ff0c59d968f6a414 (diff)
catc: Combine failure cleanup code in catc_probe()
Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/usb/catc.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 3daa41bdd4ea..985909eab72c 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -776,7 +776,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
struct net_device *netdev;
struct catc *catc;
u8 broadcast[ETH_ALEN];
- int i, pktsz;
+ int i, pktsz, ret;
if (usb_set_interface(usbdev,
intf->altsetting->desc.bInterfaceNumber, 1)) {
@@ -811,12 +811,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
if ((!catc->ctrl_urb) || (!catc->tx_urb) ||
(!catc->rx_urb) || (!catc->irq_urb)) {
dev_err(&intf->dev, "No free urbs available.\n");
- usb_free_urb(catc->ctrl_urb);
- usb_free_urb(catc->tx_urb);
- usb_free_urb(catc->rx_urb);
- usb_free_urb(catc->irq_urb);
- free_netdev(netdev);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto fail_free;
}
/* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */
@@ -913,16 +909,21 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
usb_set_intfdata(intf, catc);
SET_NETDEV_DEV(netdev, &intf->dev);
- if (register_netdev(netdev) != 0) {
- usb_set_intfdata(intf, NULL);
- usb_free_urb(catc->ctrl_urb);
- usb_free_urb(catc->tx_urb);
- usb_free_urb(catc->rx_urb);
- usb_free_urb(catc->irq_urb);
- free_netdev(netdev);
- return -EIO;
- }
+ ret = register_netdev(netdev);
+ if (ret)
+ goto fail_clear_intfdata;
+
return 0;
+
+fail_clear_intfdata:
+ usb_set_intfdata(intf, NULL);
+fail_free:
+ usb_free_urb(catc->ctrl_urb);
+ usb_free_urb(catc->tx_urb);
+ usb_free_urb(catc->rx_urb);
+ usb_free_urb(catc->irq_urb);
+ free_netdev(netdev);
+ return ret;
}
static void catc_disconnect(struct usb_interface *intf)
left'>AuthorFilesLines 2013-05-08net: of_mdio: fix behavior on missing phy deviceSebastian Hesselbarth1-7/+4 2013-04-08net: of_mdio: scan mdiobus for PHYs without reg propertySebastian Hesselbarth1-6/+58 2013-01-14net: phy: remove flags argument from phy_{attach, connect, connect_direct}Florian Fainelli1-2/+2 2012-11-29of_mdio: Honour "status=disabled" property of deviceAlexander Sverdlin1-1/+1 2012-06-27netdev/phy/of: Handle IEEE802.3 clause 45 Ethernet PHYs in of_mdiobus_register()David Daney1-4/+12 2012-06-27netdev/phy: Handle IEEE802.3 clause 45 Ethernet PHYsDavid Daney1-1/+1 2012-05-07netdev/of/phy: New function: of_mdio_find_bus().David Daney1-0/+2 2012-02-27of/mdio: fix fixed link bus nameBaruch Siach1-1/+1 2011-10-25of_mdio: Don't phy_scan_fixups() twiceKyle Moffett1-1/+0 2011-03-31Fix common misspellingsLucas De Marchi1-1/+1 2010-12-24of/mdio: Fix some endianness problems.David Daney1-9/+17 2010-06-28of/irq: Move irq_of_parse_and_map() to common codeGrant Likely1-0/+1 2010-05-22Merge remote branch 'origin' into secretlab/next-devicetreeGrant Likely1-1/+1 2010-05-18of: eliminate of_device->node and dev_archdata->{of,prom}_nodeGrant Likely1-1/+0 2010-05-18of: Always use 'struct device.of_node' to get device node pointer.Grant Likely1-2/+2 2010-04-28driver-core: Add device node pointer to struct deviceGrant Likely1-0/+1 2010-04-28of: check for IS_ERR()Dan Carpenter1-1/+1 2010-02-09of: assume big-endian properties, adding conversions where necessaryJeremy Kerr1-4/+4 2009-10-15of: Remove nested functionJérôme Pouiller1-6/+7 2009-07-22of/mdio: Add support function for Ethernet fixed-link propertyAnton Vorontsov1-0/+42 2009-04-27openfirmware: Add OF phylib support codeGrant Likely1-0/+139