]> git.baikalelectronics.ru Git - kernel.git/commit
can: bcm: registration process optimization in bcm_module_init()
authorZiyang Xuan <william.xuanziyang@huawei.com>
Thu, 15 Sep 2022 01:55:55 +0000 (09:55 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 23 Sep 2022 11:53:02 +0000 (13:53 +0200)
commitc9b34b4f4821731d79b240eb4d15fe7e5ba0c298
tree2e8318214c8989c304c3364beaaab56bff0f49a6
parent64a0f1d9ce5355588d8af6aab340a09ed4efe7e6
can: bcm: registration process optimization in bcm_module_init()

Now, register_netdevice_notifier() and register_pernet_subsys() are both
after can_proto_register(). It can create CAN_BCM socket and process socket
once can_proto_register() successfully, so it is possible missing notifier
event or proc node creation because notifier or bcm proc directory is not
registered or created yet. Although this is a low probability scenario, it
is not impossible.

Move register_pernet_subsys() and register_netdevice_notifier() to the
front of can_proto_register(). In addition, register_pernet_subsys() and
register_netdevice_notifier() may fail, check their results are necessary.

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Link: https://lore.kernel.org/all/823cff0ebec33fa9389eeaf8b8ded3217c32cb38.1663206163.git.william.xuanziyang@huawei.com
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
net/can/bcm.c