[ovs-dev] [PATCH] datapath: Directly use free_netdev for internal devices.

Jesse Gross jesse at nicira.com
Thu Nov 4 23:38:31 UTC 2010


Currently internal devices register a destructor function which
simply calls free_netdev.  Instead we can simply set the destructor
to free_netdev.  In addition to being cleaner, it is also a bug fix
because the module could be unloaded before the destructor is called,
making a call into our code illegal.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 datapath/vport-internal_dev.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 84b90b5..1122133 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -148,11 +148,6 @@ static int internal_dev_change_mtu(struct net_device *netdev, int new_mtu)
 	return 0;
 }
 
-static void internal_dev_free(struct net_device *netdev)
-{
-	free_netdev(netdev);
-}
-
 static int internal_dev_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
 	if (dp_ioctl_hook)
@@ -189,7 +184,7 @@ static void do_setup(struct net_device *netdev)
 	netdev->change_mtu = internal_dev_change_mtu;
 #endif
 
-	netdev->destructor = internal_dev_free;
+	netdev->destructor = free_netdev;
 	SET_ETHTOOL_OPS(netdev, &internal_dev_ethtool_ops);
 	netdev->tx_queue_len = 0;
 
-- 
1.7.1





More information about the dev mailing list