Commit 4e43df38 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by David S. Miller

genetlink: use idr_alloc_cyclic for family->id assignment

When allocating the next family->id it makes more sense to use
idr_alloc_cyclic to avoid re-using a previously used family->id as much
as possible.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 88ef66a2
...@@ -362,8 +362,8 @@ int genl_register_family(struct genl_family *family) ...@@ -362,8 +362,8 @@ int genl_register_family(struct genl_family *family)
} else } else
family->attrbuf = NULL; family->attrbuf = NULL;
family->id = idr_alloc(&genl_fam_idr, family, family->id = idr_alloc_cyclic(&genl_fam_idr, family,
start, end + 1, GFP_KERNEL); start, end + 1, GFP_KERNEL);
if (family->id < 0) { if (family->id < 0) {
err = family->id; err = family->id;
goto errout_free; goto errout_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment