netdev.vger.kernel.org archive mirror
 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] netdevsim: correctly check return value of debugfs_create_dir
Date: Thu, 7 Dec 2017 17:12:06 -0800	[thread overview]
Message-ID: <20171207171206.183f69a9@cakuba.netronome.com> (raw)
In-Reply-To: <20171208005250.2972-1-bhole_prashant_q7@lab.ntt.co.jp>

On Fri,  8 Dec 2017 09:52:50 +0900, Prashant Bhole wrote:
> Return value is now checked with IS_ERROR_OR_NULL because
> debugfs_create_dir doesn't return error value. It either returns
> NULL or a valid pointer.
> 
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> ---
>  drivers/net/netdevsim/netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index eb8c679fca9f..88d8ee2c89da 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -469,7 +469,7 @@ static int __init nsim_module_init(void)
>  	int err;
>  
>  	nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
> -	if (IS_ERR(nsim_ddir))
> +	if (IS_ERR_OR_NULL(nsim_ddir))
>  		return PTR_ERR(nsim_ddir);

PTR_ERR() will not be good in case of NULL, no?  But it's anyone's guess
what the correct error code would then be... the EEXIST from
start_creating() I was after is dropped in debugfs_create_dir(), as you
previously pointed out.

Maybe just drop this error handling here and in nsim_bpf_create_prog().
Let's consistently ignore all DebugFS errors.  Sorry about going back
and forth on this a little bit.

>  	err = bus_register(&nsim_bus);

  reply	other threads:[~2017-12-08  1:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  0:52 [PATCH net-next] netdevsim: correctly check return value of debugfs_create_dir Prashant Bhole
2017-12-08  1:12 ` Jakub Kicinski [this message]
2017-12-08  2:12   ` Prashant Bhole
2017-12-08 15:31 ` David Miller
2017-12-11  4:46   ` Prashant Bhole
2017-12-11 18:40     ` Jakub Kicinski
2017-12-19  4:45       ` Prashant Bhole
2017-12-19 14:11         ` David Miller
2017-12-20  0:16           ` Prashant Bhole
2017-12-20  0:30             ` Jakub Kicinski
2017-12-20  0:38               ` Prashant Bhole
2017-12-20  0:45                 ` Jakub Kicinski
2017-12-20  0:54                   ` Prashant Bhole
2017-12-20  1:18                     ` Jakub Kicinski
2017-12-20  1:40                       ` Prashant Bhole

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=20171207171206.183f69a9@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;
as well as URLs for NNTP newsgroup(s).