Skip to contentSkip to conversation

net: net_free implicit declaration

PATCH In review Randy Dunlap 2 participants 2 messages Nov 7, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: net_free implicit declaration

From: Randy Dunlap <[email protected]>

Just move the function so that is it known before it is used.

net/core/net_namespace.c: In function 'copy_net_ns':
net/core/net_namespace.c:97: error: implicit declaration of function 'net_free' net/core/net_namespace.c: At top level:
net/core/net_namespace.c:104: warning: conflicting types for 'net_free' net/core/net_namespace.c:104: error: static declaration of 'net_free' follows non-static declaration net/core/net_namespace.c:97: error: previous implicit declaration of 'net_free' was here make[2]: *** [net/core/net_namespace.o] Error 1

---
 net/core/net_namespace.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
net/core/net_namespace.c +14 -14
@@ -64,6 +64,20 @@ static struct net *net_alloc(void)
 	return kmem_cache_zalloc(net_cachep, GFP_KERNEL);
 }
 
+static void net_free(struct net *net)
+{
+	if (!net)
+		return;
+
+	if (unlikely(atomic_read(&net->use_count) != 0)) {
+		printk(KERN_EMERG "network namespace not free! Usage: %d\n",
+			atomic_read(&net->use_count));
+		return;
+	}
+
+	kmem_cache_free(net_cachep, net);
+}
+
 struct net *copy_net_ns(unsigned long flags, struct net *old_net)
 {
 	struct net *new_net = NULL;
@@ -100,20 +114,6 @@ out:
 	return new_net;
 }
 
-static void net_free(struct net *net)
-{
-	if (!net)
-		return;
-
-	if (unlikely(atomic_read(&net->use_count) != 0)) {
-		printk(KERN_EMERG "network namespace not free! Usage: %d\n",
-			atomic_read(&net->use_count));
-		return;
-	}
-
-	kmem_cache_free(net_cachep, net);
-}
-
 static void cleanup_net(struct work_struct *work)
 {
 	struct pernet_operations *ops;
maintainer
#1 lore raw

From: Randy Dunlap <[email protected]>
Date: Tue, 6 Nov 2007 19:06:29 -0800

Quoted 12 lines

From: Randy Dunlap <[email protected]>

Just move the function so that is it known before it is used.

net/core/net_namespace.c: In function 'copy_net_ns':
net/core/net_namespace.c:97: error: implicit declaration of function 'net_free' net/core/net_namespace.c: At top level:
net/core/net_namespace.c:104: warning: conflicting types for 'net_free' net/core/net_namespace.c:104: error: static declaration of 'net_free' follows non-static declaration net/core/net_namespace.c:97: error: previous implicit declaration of 'net_free' was here make[2]: *** [net/core/net_namespace.o] Error 1

Quoted 1 line

This is already fixed in the net-2.6 tree.
I'll push it to Linus after I'm done sorting another bug.