netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] netdevsim: remove return value check of debugfs_create_dir
@ 2017-12-08  5:32 Prashant Bhole
  2017-12-08  6:03 ` Jakub Kicinski
  2017-12-08 15:46 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Prashant Bhole @ 2017-12-08  5:32 UTC (permalink / raw)
  To: David S . Miller; +Cc: Prashant Bhole, netdev, Jakub Kicinski

Reason:
Discussion started about adding error check on return value where
it was not handled. Also handling the error using IS_ERR_OR_NULL
instead of IS_ERR(), because debugfs_create_dir() doesn't return
error. It returns NULL or a valid pointer when DebugFS is enabled.

Finally it was decided to remove error handling altogether to
make it consistent and removal of this check isn't fatal to the driver.

Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
 drivers/net/netdevsim/bpf.c    | 5 -----
 drivers/net/netdevsim/netdev.c | 2 --
 2 files changed, 7 deletions(-)

diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c
index 078d2c37a6c1..03c09e8b99bd 100644
--- a/drivers/net/netdevsim/bpf.c
+++ b/drivers/net/netdevsim/bpf.c
@@ -214,11 +214,6 @@ static int nsim_bpf_create_prog(struct netdevsim *ns, struct bpf_prog *prog)
 	/* Program id is not populated yet when we create the state. */
 	sprintf(name, "%u", ns->prog_id_gen++);
 	state->ddir = debugfs_create_dir(name, ns->ddir_bpf_bound_progs);
-	if (IS_ERR(state->ddir)) {
-		err = PTR_ERR(state->ddir);
-		kfree(state);
-		return err;
-	}
 
 	debugfs_create_u32("id", 0400, state->ddir, &prog->aux->id);
 	debugfs_create_file("state", 0400, state->ddir,
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

end of thread, other threads:[~2017-12-08 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-08  5:32 [PATCH net-next v2] netdevsim: remove return value check of debugfs_create_dir Prashant Bhole
2017-12-08  6:03 ` Jakub Kicinski
2017-12-08 15:46 ` 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).