Message ID | 20220923120859.740577-2-mkl@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | edd1a7e42f1d2d09c5f79ecef05ae19dc669bf34 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,01/11] can: bcm: registration process optimization in bcm_module_init() | expand |
Hello: This series was applied to netdev/net-next.git (master) by Marc Kleine-Budde <mkl@pengutronix.de>: On Fri, 23 Sep 2022 14:08:49 +0200 you wrote: > From: Ziyang Xuan <william.xuanziyang@huawei.com> > > 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. > > [...] Here is the summary with links: - [net-next,01/11] can: bcm: registration process optimization in bcm_module_init() https://git.kernel.org/netdev/net-next/c/edd1a7e42f1d - [net-next,02/11] can: bcm: check the result of can_send() in bcm_can_tx() https://git.kernel.org/netdev/net-next/c/3fd7bfd28cfd - [net-next,03/11] can: gs_usb: gs_usb_get_timestamp(): fix endpoint parameter for usb_control_msg_recv() https://git.kernel.org/netdev/net-next/c/593b5e2f5a4a - [net-next,04/11] can: gs_usb: add missing lock to protect struct timecounter::cycle_last https://git.kernel.org/netdev/net-next/c/29a8c9ec9090 - [net-next,05/11] can: gs_usb: gs_can_open(): initialize time counter before starting device https://git.kernel.org/netdev/net-next/c/103108cb9673 - [net-next,06/11] can: gs_usb: gs_cmd_reset(): rename variable holding struct gs_can pointer to dev https://git.kernel.org/netdev/net-next/c/002467518688 - [net-next,07/11] can: gs_usb: convert from usb_control_msg() to usb_control_msg_{send,recv}() https://git.kernel.org/netdev/net-next/c/3814ed27548a - [net-next,08/11] can: gs_usb: gs_make_candev(): clean up error handling https://git.kernel.org/netdev/net-next/c/68822f4e74f3 - [net-next,09/11] can: gs_usb: add switchable termination support https://git.kernel.org/netdev/net-next/c/906e0e6886af - [net-next,10/11] can: gs_usb: remove dma allocations https://git.kernel.org/netdev/net-next/c/62f102c0d156 - [net-next,11/11] can: ctucanfd: Remove redundant dev_err call https://git.kernel.org/netdev/net-next/c/6eed756408c6 You are awesome, thank you!
diff --git a/net/can/bcm.c b/net/can/bcm.c index e5d179ba6f7d..0a2adb844280 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1749,15 +1749,27 @@ static int __init bcm_module_init(void) pr_info("can: broadcast manager protocol\n"); + err = register_pernet_subsys(&canbcm_pernet_ops); + if (err) + return err; + + err = register_netdevice_notifier(&canbcm_notifier); + if (err) + goto register_notifier_failed; + err = can_proto_register(&bcm_can_proto); if (err < 0) { printk(KERN_ERR "can: registration of bcm protocol failed\n"); - return err; + goto register_proto_failed; } - register_pernet_subsys(&canbcm_pernet_ops); - register_netdevice_notifier(&canbcm_notifier); return 0; + +register_proto_failed: + unregister_netdevice_notifier(&canbcm_notifier); +register_notifier_failed: + unregister_pernet_subsys(&canbcm_pernet_ops); + return err; } static void __exit bcm_module_exit(void)