Merge branch 'mhi-net-immutable' of https://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / net / ethernet / natsemi / macsonic.c
index 776b7d2..2289e1f 100644 (file)
@@ -506,10 +506,14 @@ static int mac_sonic_platform_probe(struct platform_device *pdev)
 
        err = register_netdev(dev);
        if (err)
-               goto out;
+               goto undo_probe;
 
        return 0;
 
+undo_probe:
+       dma_free_coherent(lp->device,
+                         SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
+                         lp->descriptors, lp->descriptors_laddr);
 out:
        free_netdev(dev);
 
@@ -584,12 +588,16 @@ static int mac_sonic_nubus_probe(struct nubus_board *board)
 
        err = register_netdev(ndev);
        if (err)
-               goto out;
+               goto undo_probe;
 
        nubus_set_drvdata(board, ndev);
 
        return 0;
 
+undo_probe:
+       dma_free_coherent(lp->device,
+                         SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
+                         lp->descriptors, lp->descriptors_laddr);
 out:
        free_netdev(ndev);
        return err;