[NET] front: Clean up error handling. This eliminates earlier
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 31 Oct 2006 16:18:07 +0000 (16:18 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 31 Oct 2006 16:18:07 +0000 (16:18 +0000)
workaround patch for an observed crash.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c

index 1324345f9442b7cbc1cf4b1e4d6c52da04cadcac..10f6d47994168ecf20d404de69ebfeb5e4a2a9d7 100644 (file)
@@ -242,7 +242,6 @@ static void end_access(int, void *);
 static void netif_disconnect_backend(struct netfront_info *);
 static int open_netdev(struct netfront_info *);
 static void close_netdev(struct netfront_info *);
-static void netif_free(struct netfront_info *);
 
 static int network_connect(struct net_device *);
 static void network_tx_buf_gc(struct net_device *);
@@ -428,7 +427,6 @@ again:
        return err;
 }
 
-
 static int setup_device(struct xenbus_device *dev, struct netfront_info *info)
 {
        struct netif_tx_sring *txs;
@@ -488,11 +486,9 @@ static int setup_device(struct xenbus_device *dev, struct netfront_info *info)
        return 0;
 
  fail:
-       netif_free(info);
        return err;
 }
 
-
 /**
  * Callback received when the backend's state changes.
  */
@@ -513,24 +509,18 @@ static void backend_changed(struct xenbus_device *dev,
                break;
 
        case XenbusStateInitWait:
-               if (network_connect(netdev) != 0) {
-                       netif_free(np);
+               if (network_connect(netdev) != 0)
                        break;
-               }
                xenbus_switch_state(dev, XenbusStateConnected);
                (void)send_fake_arp(netdev);
                break;
 
        case XenbusStateClosing:
-               if (dev->state == XenbusStateConnected)
-                       netfront_closing(dev);
-               else
-                       printk(KERN_DEBUG "Netfront: going to state Closing without being connected...\n");
+               netfront_closing(dev);
                break;
        }
 }
 
-
 /** Send a packet on a net device to encourage switches to learn the
  * MAC. We send a fake ARP request.
  *
@@ -559,7 +549,6 @@ static int send_fake_arp(struct net_device *dev)
        return dev_queue_xmit(skb);
 }
 
-
 static int network_open(struct net_device *dev)
 {
        struct netfront_info *np = netdev_priv(dev);
@@ -651,14 +640,12 @@ static void network_tx_buf_gc(struct net_device *dev)
        network_maybe_wake_tx(dev);
 }
 
-
 static void rx_refill_timeout(unsigned long data)
 {
        struct net_device *dev = (struct net_device *)data;
        netif_rx_schedule(dev);
 }
 
-
 static void network_alloc_rx_buffers(struct net_device *dev)
 {
        unsigned short id;
@@ -2066,14 +2053,6 @@ static void netif_disconnect_backend(struct netfront_info *info)
 }
 
 
-static void netif_free(struct netfront_info *info)
-{
-       close_netdev(info);
-       netif_disconnect_backend(info);
-       free_netdev(info->netdev);
-}
-
-
 static void end_access(int ref, void *page)
 {
        if (ref != GRANT_INVALID_REF)