int p_id, int pdev_id, char *p_name,
proc_handler *handler, ctl_handler *strategy)
{
- struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template,
- sizeof(*t), GFP_KERNEL);
+ struct neigh_sysctl_table *t;
const char *dev_name_source = NULL;
char *dev_name = NULL;
- int err = 0;
+ t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL);
if (!t)
- return -ENOBUFS;
+ goto err;
+
t->neigh_vars[0].data = &p->mcast_probes;
t->neigh_vars[1].data = &p->ucast_probes;
t->neigh_vars[2].data = &p->app_probes;
}
dev_name = kstrdup(dev_name_source, GFP_KERNEL);
- if (!dev_name) {
- err = -ENOBUFS;
+ if (!dev_name)
goto free;
- }
t->neigh_dev[0].procname = dev_name;
t->neigh_root_dir[0].child = t->neigh_proto_dir;
t->sysctl_header = register_sysctl_table(t->neigh_root_dir);
- if (!t->sysctl_header) {
- err = -ENOBUFS;
+ if (!t->sysctl_header)
goto free_procname;
- }
+
p->sysctl_table = t;
return 0;
- /* error path */
- free_procname:
+free_procname:
kfree(dev_name);
- free:
+free:
kfree(t);
-
- return err;
+err:
+ return -ENOBUFS;
}
void neigh_sysctl_unregister(struct neigh_parms *p)