From: Krishna Kumar Date: Wed, 14 Oct 2009 19:54:53 +0000 (+0000) Subject: genetlink: Optimize genl_register_family() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=93860b08e31a3202b6e67e386811545e719a0165;p=linux-beck.git genetlink: Optimize genl_register_family() 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 Signed-off-by: David S. Miller --- diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 44ff3f3810fa..ddfdb7d2e02b 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -374,11 +374,6 @@ int genl_register_family(struct genl_family *family) 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_family *family) } family->id = newid; + } else if (genl_family_find_byid(family->id)) { + err = -EEXIST; + goto errout_locked; } if (family->maxattr) {