[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230923115847.32740-1-liuhaoran14@163.com>
Date: Sat, 23 Sep 2023 19:58:47 +0800
From: liuhaoran <liuhaoran14@....com>
To: davem@...emloft.net
Cc: edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
netdev@...r.kernel.org,
liuhaoran <liuhaoran14@....com>
Subject: [PATCH] net: phonet: Add error handling in phonet_device_init
This patch adds error-handling for the proc_create_net() and
register_netdevice_notifier() inside the phonet_device_init.
Signed-off-by: liuhaoran <liuhaoran14@....com>
---
net/phonet/pn_dev.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index cde671d29d5d..c974b64d52b9 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -336,10 +336,19 @@ int __init phonet_device_init(void)
if (err)
return err;
- proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
- sizeof(struct seq_net_private));
- register_netdevice_notifier(&phonet_device_notifier);
+ err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
+ sizeof(struct seq_net_private));
+
+ if (!err)
+ return err;
+
+ err = register_netdevice_notifier(&phonet_device_notifier);
+
+ if (!err)
+ return err;
+
err = phonet_netlink_register();
+
if (err)
phonet_device_exit();
return err;
--
2.17.1
Powered by blists - more mailing lists