This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / net / pcmcia / fmvj18x_cs.c
index 9c40e61..580af37 100644 (file)
@@ -332,9 +332,6 @@ static void fmvj18x_detach(dev_link_t *link)
     if (*linkp == NULL)
        return;
 
-    if (link->dev)
-       unregister_netdev(dev);
-
     if (link->state & DEV_CONFIG)
        fmvj18x_release(link);
 
@@ -344,6 +341,8 @@ static void fmvj18x_detach(dev_link_t *link)
     
     /* Unlink device structure, free pieces */
     *linkp = link->next;
+    if (link->dev)
+       unregister_netdev(dev);
     free_netdev(dev);
 } /* fmvj18x_detach */
 
@@ -742,8 +741,10 @@ static int fmvj18x_event(event_t event, int priority,
     switch (event) {
     case CS_EVENT_CARD_REMOVAL:
        link->state &= ~DEV_PRESENT;
-       if (link->state & DEV_CONFIG)
+       if (link->state & DEV_CONFIG) {
            netif_device_detach(dev);
+           fmvj18x_release(link);
+       }
        break;
     case CS_EVENT_CARD_INSERTION:
        link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;