aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrew hendry <andrew.hendry@gmail.com>2009-11-24 15:15:42 +0000
committerDavid S. Miller <davem@davemloft.net>2009-11-29 00:25:01 -0800
commit1fd975a0520cdb27681855d5a18526e328d36b5c (patch)
treea4e0aa79bf898054ed40afd50f38811e5db771dd
parent2f5517aefcfbdd7fdf0f03b13d292a10d445887f (diff)
X25: Check for errors in x25_init
Adds error checking to x25_init. Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/x25/af_x25.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index f327ef5cb0e..e3219e4cd04 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -1721,18 +1721,31 @@ static int __init x25_init(void)
if (rc != 0)
goto out;
- sock_register(&x25_family_ops);
+ rc = sock_register(&x25_family_ops);
+ if (rc != 0)
+ goto out_proto;
dev_add_pack(&x25_packet_type);
- register_netdevice_notifier(&x25_dev_notifier);
+ rc = register_netdevice_notifier(&x25_dev_notifier);
+ if (rc != 0)
+ goto out_sock;
printk(KERN_INFO "X.25 for Linux Version 0.2\n");
x25_register_sysctl();
- x25_proc_init();
+ rc = x25_proc_init();
+ if (rc != 0)
+ goto out_dev;
out:
return rc;
+out_dev:
+ unregister_netdevice_notifier(&x25_dev_notifier);
+out_sock:
+ sock_unregister(AF_X25);
+out_proto:
+ proto_unregister(&x25_proto);
+ goto out;
}
module_init(x25_init);