]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/stmmac/stmmac_main.c
stmmac: handle allocation errors in setup functions
[net-next-2.6.git] / drivers / net / stmmac / stmmac_main.c
index acf06168694035253c91d584c48c45bde654138f..0bdd3326c94a5fbf06848c0827288fe88bd7e57a 100644 (file)
@@ -1558,15 +1558,15 @@ static int stmmac_mac_device_setup(struct net_device *dev)
        else
                device = dwmac100_setup(ioaddr);
 
+       if (!device)
+               return -ENOMEM;
+
        if (priv->enh_desc) {
                device->desc = &enh_desc_ops;
                pr_info("\tEnhanced descriptor structure\n");
        } else
                device->desc = &ndesc_ops;
 
-       if (!device)
-               return -ENOMEM;
-
        priv->hw = device;
 
        priv->wolenabled = priv->hw->pmt;       /* PMT supported */