Skip to content

Commit

Permalink
genetlink: Optimize genl_register_family()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
krkumar authored and davem330 committed Oct 18, 2009
1 parent 0d9a40d commit 93860b0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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) {
Expand Down

0 comments on commit 93860b0

Please sign in to comment.