]> git.itanic.dy.fi Git - linux-stable/blobdiff - drivers/net/ethernet/3com/3c589_cs.c
3c589_cs: Fix an error handling path in tc589_probe()
[linux-stable] / drivers / net / ethernet / 3com / 3c589_cs.c
index 82f94b1635bf816150e5f3c4f7d3e71417d81263..5267e9dcd87ef90927e7806206dba7d108e96ddc 100644 (file)
@@ -195,6 +195,7 @@ static int tc589_probe(struct pcmcia_device *link)
 {
        struct el3_private *lp;
        struct net_device *dev;
+       int ret;
 
        dev_dbg(&link->dev, "3c589_attach()\n");
 
@@ -218,7 +219,15 @@ static int tc589_probe(struct pcmcia_device *link)
 
        dev->ethtool_ops = &netdev_ethtool_ops;
 
-       return tc589_config(link);
+       ret = tc589_config(link);
+       if (ret)
+               goto err_free_netdev;
+
+       return 0;
+
+err_free_netdev:
+       free_netdev(dev);
+       return ret;
 }
 
 static void tc589_detach(struct pcmcia_device *link)