Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172047
b: refs/heads/master
c: d2b3eb6
h: refs/heads/master
i:
  172045: a9e51a9
  172043: 94e2c39
  172039: 8d76023
  172031: 34ad129
v: v3
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Dec 2, 2009
1 parent 6834933 commit 63a0754
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aaab3405e03e91d0e8d30c9d327a2265a7121854
refs/heads/master: d2b3eb630767f0b0ae21566b1b88cb512f40c647
16 changes: 6 additions & 10 deletions trunk/net/phonet/pn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,19 +313,14 @@ static struct notifier_block phonet_device_notifier = {
/* Per-namespace Phonet devices handling */
static int phonet_init_net(struct net *net)
{
struct phonet_net *pnn = kzalloc(sizeof(*pnn), GFP_KERNEL);
if (!pnn)
return -ENOMEM;
struct phonet_net *pnn = net_generic(net, phonet_net_id);

if (!proc_net_fops_create(net, "phonet", 0, &pn_sock_seq_fops)) {
kfree(pnn);
if (!proc_net_fops_create(net, "phonet", 0, &pn_sock_seq_fops))
return -ENOMEM;
}

INIT_LIST_HEAD(&pnn->pndevs.list);
mutex_init(&pnn->pndevs.lock);
mutex_init(&pnn->routes.lock);
net_assign_generic(net, phonet_net_id, pnn);
return 0;
}

Expand All @@ -349,18 +344,19 @@ static void phonet_exit_net(struct net *net)
rtnl_unlock();

proc_net_remove(net, "phonet");
kfree(pnn);
}

static struct pernet_operations phonet_net_ops = {
.init = phonet_init_net,
.exit = phonet_exit_net,
.id = &phonet_net_id,
.size = sizeof(struct phonet_net),
};

/* Initialize Phonet devices list */
int __init phonet_device_init(void)
{
int err = register_pernet_gen_device(&phonet_net_id, &phonet_net_ops);
int err = register_pernet_device(&phonet_net_ops);
if (err)
return err;

Expand All @@ -375,7 +371,7 @@ void phonet_device_exit(void)
{
rtnl_unregister_all(PF_PHONET);
unregister_netdevice_notifier(&phonet_device_notifier);
unregister_pernet_gen_device(phonet_net_id, &phonet_net_ops);
unregister_pernet_device(&phonet_net_ops);
}

int phonet_route_add(struct net_device *dev, u8 daddr)
Expand Down

0 comments on commit 63a0754

Please sign in to comment.