Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Cc: "David S . Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] netdevsim: correctly check return value of debugfs_create_dir
Date: Tue, 19 Dec 2017 18:34:37 -0800	[thread overview]
Message-ID: <20171219183437.4b75dc10@cakuba.netronome.com> (raw)
In-Reply-To: <20171220022715.2356-1-bhole_prashant_q7@lab.ntt.co.jp>

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@netronome.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;
>  }
>  

      reply	other threads:[~2017-12-20  2:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20  2:27 [PATCH net-next v2] netdevsim: correctly check return value of debugfs_create_dir Prashant Bhole
2017-12-20  2:34 ` Jakub Kicinski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171219183437.4b75dc10@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=bhole_prashant_q7@lab.ntt.co.jp \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox