[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171219183437.4b75dc10@cakuba.netronome.com>
Date: Tue, 19 Dec 2017 18:34:37 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>
Cc: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2] netdevsim: correctly check return value of
debugfs_create_dir
On Wed, 20 Dec 2017 11:27:15 +0900, Prashant Bhole wrote:
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index eb8c679fca9f..c2a02d1944b8 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -147,10 +147,12 @@ struct device_type nsim_dev_type = {
> static int nsim_init(struct net_device *dev)
> {
> struct netdevsim *ns = netdev_priv(dev);
> - int err;
> + int err = -ENOMEM;
>
> ns->netdev = dev;
> ns->ddir = debugfs_create_dir(netdev_name(dev), nsim_ddir);
> + if (IS_ERR_OR_NULL(ns->ddir))
> + goto err;
nit:
Could you return err; here directly instead of go(ing )to return
and having label and variable of the same name? Same in
nsim_module_init().
With that feel free to add:
Acked-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
Thanks!
> err = nsim_bpf_init(ns);
> if (err)
> @@ -171,6 +173,7 @@ static int nsim_init(struct net_device *dev)
> nsim_bpf_uninit(ns);
> err_debugfs_destroy:
> debugfs_remove_recursive(ns->ddir);
> +err:
> return err;
> }
>
Powered by blists - more mailing lists