diff options
-rw-r--r-- | net/caif/caif_dev.c | 22 | ||||
-rw-r--r-- | net/caif/cfcnfg.c | 1 |
2 files changed, 2 insertions, 21 deletions
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 673728add60b..82c57069415f 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -59,8 +59,6 @@ struct cfcnfg *get_cfcnfg(struct net *net) | |||
59 | { | 59 | { |
60 | struct caif_net *caifn; | 60 | struct caif_net *caifn; |
61 | caifn = net_generic(net, caif_net_id); | 61 | caifn = net_generic(net, caif_net_id); |
62 | if (!caifn) | ||
63 | return NULL; | ||
64 | return caifn->cfg; | 62 | return caifn->cfg; |
65 | } | 63 | } |
66 | EXPORT_SYMBOL(get_cfcnfg); | 64 | EXPORT_SYMBOL(get_cfcnfg); |
@@ -69,8 +67,6 @@ static struct caif_device_entry_list *caif_device_list(struct net *net) | |||
69 | { | 67 | { |
70 | struct caif_net *caifn; | 68 | struct caif_net *caifn; |
71 | caifn = net_generic(net, caif_net_id); | 69 | caifn = net_generic(net, caif_net_id); |
72 | if (!caifn) | ||
73 | return NULL; | ||
74 | return &caifn->caifdevs; | 70 | return &caifn->caifdevs; |
75 | } | 71 | } |
76 | 72 | ||
@@ -99,8 +95,6 @@ static struct caif_device_entry *caif_device_alloc(struct net_device *dev) | |||
99 | struct caif_device_entry *caifd; | 95 | struct caif_device_entry *caifd; |
100 | 96 | ||
101 | caifdevs = caif_device_list(dev_net(dev)); | 97 | caifdevs = caif_device_list(dev_net(dev)); |
102 | if (!caifdevs) | ||
103 | return NULL; | ||
104 | 98 | ||
105 | caifd = kzalloc(sizeof(*caifd), GFP_KERNEL); | 99 | caifd = kzalloc(sizeof(*caifd), GFP_KERNEL); |
106 | if (!caifd) | 100 | if (!caifd) |
@@ -120,8 +114,6 @@ static struct caif_device_entry *caif_get(struct net_device *dev) | |||
120 | struct caif_device_entry_list *caifdevs = | 114 | struct caif_device_entry_list *caifdevs = |
121 | caif_device_list(dev_net(dev)); | 115 | caif_device_list(dev_net(dev)); |
122 | struct caif_device_entry *caifd; | 116 | struct caif_device_entry *caifd; |
123 | if (!caifdevs) | ||
124 | return NULL; | ||
125 | 117 | ||
126 | list_for_each_entry_rcu(caifd, &caifdevs->list, list) { | 118 | list_for_each_entry_rcu(caifd, &caifdevs->list, list) { |
127 | if (caifd->netdev == dev) | 119 | if (caifd->netdev == dev) |
@@ -321,8 +313,6 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, | |||
321 | struct caif_device_entry_list *caifdevs; | 313 | struct caif_device_entry_list *caifdevs; |
322 | 314 | ||
323 | caifdevs = caif_device_list(dev_net(dev)); | 315 | caifdevs = caif_device_list(dev_net(dev)); |
324 | if (!cfg || !caifdevs) | ||
325 | return; | ||
326 | caifd = caif_device_alloc(dev); | 316 | caifd = caif_device_alloc(dev); |
327 | if (!caifd) | 317 | if (!caifd) |
328 | return; | 318 | return; |
@@ -374,8 +364,6 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, | |||
374 | 364 | ||
375 | cfg = get_cfcnfg(dev_net(dev)); | 365 | cfg = get_cfcnfg(dev_net(dev)); |
376 | caifdevs = caif_device_list(dev_net(dev)); | 366 | caifdevs = caif_device_list(dev_net(dev)); |
377 | if (!cfg || !caifdevs) | ||
378 | return 0; | ||
379 | 367 | ||
380 | caifd = caif_get(dev); | 368 | caifd = caif_get(dev); |
381 | if (caifd == NULL && dev->type != ARPHRD_CAIF) | 369 | if (caifd == NULL && dev->type != ARPHRD_CAIF) |
@@ -507,9 +495,6 @@ static struct notifier_block caif_device_notifier = { | |||
507 | static int caif_init_net(struct net *net) | 495 | static int caif_init_net(struct net *net) |
508 | { | 496 | { |
509 | struct caif_net *caifn = net_generic(net, caif_net_id); | 497 | struct caif_net *caifn = net_generic(net, caif_net_id); |
510 | if (WARN_ON(!caifn)) | ||
511 | return -EINVAL; | ||
512 | |||
513 | INIT_LIST_HEAD(&caifn->caifdevs.list); | 498 | INIT_LIST_HEAD(&caifn->caifdevs.list); |
514 | mutex_init(&caifn->caifdevs.lock); | 499 | mutex_init(&caifn->caifdevs.lock); |
515 | 500 | ||
@@ -527,9 +512,6 @@ static void caif_exit_net(struct net *net) | |||
527 | caif_device_list(net); | 512 | caif_device_list(net); |
528 | struct cfcnfg *cfg = get_cfcnfg(net); | 513 | struct cfcnfg *cfg = get_cfcnfg(net); |
529 | 514 | ||
530 | if (!cfg || !caifdevs) | ||
531 | return; | ||
532 | |||
533 | rtnl_lock(); | 515 | rtnl_lock(); |
534 | mutex_lock(&caifdevs->lock); | 516 | mutex_lock(&caifdevs->lock); |
535 | 517 | ||
@@ -569,7 +551,7 @@ static int __init caif_device_init(void) | |||
569 | { | 551 | { |
570 | int result; | 552 | int result; |
571 | 553 | ||
572 | result = register_pernet_device(&caif_net_ops); | 554 | result = register_pernet_subsys(&caif_net_ops); |
573 | 555 | ||
574 | if (result) | 556 | if (result) |
575 | return result; | 557 | return result; |
@@ -582,7 +564,7 @@ static int __init caif_device_init(void) | |||
582 | 564 | ||
583 | static void __exit caif_device_exit(void) | 565 | static void __exit caif_device_exit(void) |
584 | { | 566 | { |
585 | unregister_pernet_device(&caif_net_ops); | 567 | unregister_pernet_subsys(&caif_net_ops); |
586 | unregister_netdevice_notifier(&caif_device_notifier); | 568 | unregister_netdevice_notifier(&caif_device_notifier); |
587 | dev_remove_pack(&caif_packet_type); | 569 | dev_remove_pack(&caif_packet_type); |
588 | } | 570 | } |
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 598aafb4cb51..ba9cfd47778a 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -309,7 +309,6 @@ int caif_connect_client(struct net *net, struct caif_connect_request *conn_req, | |||
309 | int err; | 309 | int err; |
310 | struct cfctrl_link_param param; | 310 | struct cfctrl_link_param param; |
311 | struct cfcnfg *cfg = get_cfcnfg(net); | 311 | struct cfcnfg *cfg = get_cfcnfg(net); |
312 | caif_assert(cfg != NULL); | ||
313 | 312 | ||
314 | rcu_read_lock(); | 313 | rcu_read_lock(); |
315 | err = caif_connect_req_to_link_param(cfg, conn_req, ¶m); | 314 | err = caif_connect_req_to_link_param(cfg, conn_req, ¶m); |