* [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir
@ 2017-12-08 2:14 Prashant Bhole
2017-12-08 2:47 ` Jakub Kicinski
2017-12-08 15:36 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Prashant Bhole @ 2017-12-08 2:14 UTC (permalink / raw)
To: David S . Miller; +Cc: Prashant Bhole, netdev, Jakub Kicinski
Initial discussion started about correct handling of this condition.
Later it was decided to remove this check altogether to make it
consistent.
Removal of this check isn't fatal to this driver.
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
drivers/net/netdevsim/netdev.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index eb8c679fca9f..6d4b35f26ae5 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -469,8 +469,6 @@ static int __init nsim_module_init(void)
int err;
nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
- if (IS_ERR(nsim_ddir))
- return PTR_ERR(nsim_ddir);
err = bus_register(&nsim_bus);
if (err)
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir
2017-12-08 2:14 [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir Prashant Bhole
@ 2017-12-08 2:47 ` Jakub Kicinski
2017-12-08 15:36 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2017-12-08 2:47 UTC (permalink / raw)
To: Prashant Bhole; +Cc: David S . Miller, netdev
On Fri, 8 Dec 2017 11:14:56 +0900, Prashant Bhole wrote:
> Initial discussion started about correct handling of this condition.
> Later it was decided to remove this check altogether to make it
> consistent.
>
> Removal of this check isn't fatal to this driver.
>
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
but as I mentioned there is another, similar check in netdevsim/bpf.c:
"... drop this error handling here and in nsim_bpf_create_prog()."
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index eb8c679fca9f..6d4b35f26ae5 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -469,8 +469,6 @@ static int __init nsim_module_init(void)
> int err;
>
> nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
> - if (IS_ERR(nsim_ddir))
> - return PTR_ERR(nsim_ddir);
>
> err = bus_register(&nsim_bus);
> if (err)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir
2017-12-08 2:14 [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir Prashant Bhole
2017-12-08 2:47 ` Jakub Kicinski
@ 2017-12-08 15:36 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-12-08 15:36 UTC (permalink / raw)
To: bhole_prashant_q7; +Cc: netdev, jakub.kicinski
From: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Date: Fri, 8 Dec 2017 11:14:56 +0900
> Initial discussion started about correct handling of this condition.
> Later it was decided to remove this check altogether to make it
> consistent.
>
> Removal of this check isn't fatal to this driver.
...
> @@ -469,8 +469,6 @@ static int __init nsim_module_init(void)
> int err;
>
> nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
> - if (IS_ERR(nsim_ddir))
> - return PTR_ERR(nsim_ddir);
>
> err = bus_register(&nsim_bus);
Please stop this madness.
You cannot continue if this thing returns NULL.
WHY?
Because later if you pass NULL to debugfs_create_dir() in nsim_init() do
you have any idea what it is going to do?
It's going to put the netdevsim device files into the root!
Please:
1) Handle the errors
2) Make them fatal, if DEBUGFS is enabled this should never fail except
for memory allocation failures and we have bigger problems than
successfully loading the netdevsim driver
3) Fix debugfs_create_dir() to have sane return value semantics so that
people do not have to check both NULL and error pointers
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-08 15:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-08 2:14 [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir Prashant Bhole
2017-12-08 2:47 ` Jakub Kicinski
2017-12-08 15:36 ` David Miller
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).