diff options
-rw-r--r-- | include/net/phonet/pn_dev.h | 2 | ||||
-rw-r--r-- | net/phonet/pn_dev.c | 8 | ||||
-rw-r--r-- | net/phonet/pn_netlink.c | 13 |
3 files changed, 16 insertions, 7 deletions
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h index 59ae628b1111..4ba2aedaa507 100644 --- a/include/net/phonet/pn_dev.h +++ b/include/net/phonet/pn_dev.h | |||
@@ -38,7 +38,7 @@ struct phonet_device { | |||
38 | 38 | ||
39 | int phonet_device_init(void); | 39 | int phonet_device_init(void); |
40 | void phonet_device_exit(void); | 40 | void phonet_device_exit(void); |
41 | void phonet_netlink_register(void); | 41 | int phonet_netlink_register(void); |
42 | struct net_device *phonet_device_get(struct net *net); | 42 | struct net_device *phonet_device_get(struct net *net); |
43 | 43 | ||
44 | int phonet_address_add(struct net_device *dev, u8 addr); | 44 | int phonet_address_add(struct net_device *dev, u8 addr); |
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index af49db01d634..fd418107652b 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -190,9 +190,13 @@ static struct notifier_block phonet_device_notifier = { | |||
190 | /* Initialize Phonet devices list */ | 190 | /* Initialize Phonet devices list */ |
191 | int __init phonet_device_init(void) | 191 | int __init phonet_device_init(void) |
192 | { | 192 | { |
193 | int err; | ||
194 | |||
193 | register_netdevice_notifier(&phonet_device_notifier); | 195 | register_netdevice_notifier(&phonet_device_notifier); |
194 | phonet_netlink_register(); | 196 | err = phonet_netlink_register(); |
195 | return 0; | 197 | if (err) |
198 | phonet_device_exit(); | ||
199 | return err; | ||
196 | } | 200 | } |
197 | 201 | ||
198 | void phonet_device_exit(void) | 202 | void phonet_device_exit(void) |
diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c index 242fe8f8c322..918a4f07f24a 100644 --- a/net/phonet/pn_netlink.c +++ b/net/phonet/pn_netlink.c | |||
@@ -160,9 +160,14 @@ out: | |||
160 | return skb->len; | 160 | return skb->len; |
161 | } | 161 | } |
162 | 162 | ||
163 | void __init phonet_netlink_register(void) | 163 | int __init phonet_netlink_register(void) |
164 | { | 164 | { |
165 | rtnl_register(PF_PHONET, RTM_NEWADDR, addr_doit, NULL); | 165 | int err = __rtnl_register(PF_PHONET, RTM_NEWADDR, addr_doit, NULL); |
166 | rtnl_register(PF_PHONET, RTM_DELADDR, addr_doit, NULL); | 166 | if (err) |
167 | rtnl_register(PF_PHONET, RTM_GETADDR, NULL, getaddr_dumpit); | 167 | return err; |
168 | |||
169 | /* Further __rtnl_register() cannot fail */ | ||
170 | __rtnl_register(PF_PHONET, RTM_DELADDR, addr_doit, NULL); | ||
171 | __rtnl_register(PF_PHONET, RTM_GETADDR, NULL, getaddr_dumpit); | ||
172 | return 0; | ||
168 | } | 173 | } |