[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <820ee8da-f3fa-449a-ac5f-d6ac91f983f0@lunn.ch>
Date: Sat, 23 Sep 2023 19:08:39 +0200
From: Andrew Lunn <andrew@...n.ch>
To: liuhaoran <liuhaoran14@....com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org
Subject: Re: [PATCH] net: phonet: Add error handling in phonet_device_init
On Sat, Sep 23, 2023 at 07:58:47PM +0800, liuhaoran wrote:
> 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;
As the build bot has shown, you should at least compile test your
changes.
> +
> + err = register_netdevice_notifier(&phonet_device_notifier);
> +
> + if (!err)
> + return err;
> +
If this fails, you should clean up proc.
Andrew
Powered by blists - more mailing lists