[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171208.103110.1740849637875852344.davem@davemloft.net>
Date: Fri, 08 Dec 2017 10:31:10 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: bhole_prashant_q7@....ntt.co.jp
Cc: netdev@...r.kernel.org, jakub.kicinski@...ronome.com
Subject: Re: [PATCH net-next] netdevsim: correctly check return value of
debugfs_create_dir
From: Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>
Date: Fri, 8 Dec 2017 09:52:50 +0900
> 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@....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);
debugfs_create_dir() should really be fixed, either it uses error pointers
consistently and therefore always provides a suitable error code to return
or it always uses NULL.
This in-between behavior makes using it as an interface painful because
no clear meaning is given to NULL.
So please do the work necessary to make debugfs_create_dir()'s return
semantics clearer and more useful.
Thank you.
Powered by blists - more mailing lists