netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phonet: Add error handling in phonet_device_init
@ 2023-09-23 11:58 liuhaoran
  2023-09-23 14:37 ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: liuhaoran @ 2023-09-23 11:58 UTC (permalink / raw)
  To: davem; +Cc: edumazet, kuba, pabeni, netdev, liuhaoran

This patch adds error-handling for the proc_create_net() and
register_netdevice_notifier() inside the phonet_device_init.

Signed-off-by: liuhaoran <liuhaoran14@163.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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-25 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-23 11:58 [PATCH] net: phonet: Add error handling in phonet_device_init liuhaoran
2023-09-23 14:37 ` kernel test robot
2023-09-23 17:08 ` Andrew Lunn
2023-09-24  6:21 ` kernel test robot
2023-09-25 15:58 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).