/* Returns 0 on success or a negative error code.  */
int genl_unregister_family(struct genl_family *family)
/* Returns 0 on success or a negative error code.  */
int genl_unregister_family(struct genl_family *family)
{
	struct genl_family *rc;
	genl_lock();
	genl_unregister_mc_groups(family);
	list_for_each_entry(rc, genl_family_chain(family->id), family_list) {
		if (family->id != rc->id || strcmp(rc->name, family->name))
			continue;
		list_del(&rc->family_list);
		INIT_LIST_HEAD(&family->ops_list);
		genl_unlock();
		kfree(family->attrbuf);
		genl_ctrl_event(CTRL_CMD_DELFAMILY, family);
		return 0;
	}
	genl_unlock();
	return -ENOENT;
}