diff mbox

genetlink: Optimize genl_register_family()

Message ID 20091015055453.30128.12160.sendpatchset@localhost.localdomain
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Krishna Kumar Oct. 15, 2009, 5:54 a.m. UTC
From: Krishna Kumar <krkumar2@in.ibm.com>

genl_register_family() doesn't need to call genl_family_find_byid
when GENL_ID_GENERATE is passed during register.

Patch on net-next-2.6, compile and reboot testing only.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Oct. 18, 2009, 6:58 a.m. UTC | #1
From: Krishna Kumar <krkumar2@in.ibm.com>
Date: Thu, 15 Oct 2009 11:24:53 +0530

> From: Krishna Kumar <krkumar2@in.ibm.com>
> 
> genl_register_family() doesn't need to call genl_family_find_byid
> when GENL_ID_GENERATE is passed during register.
> 
> Patch on net-next-2.6, compile and reboot testing only.
> 
> Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff -ruNp org/net/netlink/genetlink.c new/net/netlink/genetlink.c
--- org/net/netlink/genetlink.c	2009-10-06 08:34:10.000000000 +0530
+++ new/net/netlink/genetlink.c	2009-10-12 13:57:38.000000000 +0530
@@ -374,11 +374,6 @@  int genl_register_family(struct genl_fam
 		goto errout_locked;
 	}
 
-	if (genl_family_find_byid(family->id)) {
-		err = -EEXIST;
-		goto errout_locked;
-	}
-
 	if (family->id == GENL_ID_GENERATE) {
 		u16 newid = genl_generate_id();
 
@@ -388,6 +383,9 @@  int genl_register_family(struct genl_fam
 		}
 
 		family->id = newid;
+	} else if (genl_family_find_byid(family->id)) {
+		err = -EEXIST;
+		goto errout_locked;
 	}
 
 	if (family->maxattr) {