diff options
author | Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> | 2017-12-20 06:18:57 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-20 21:58:48 +0300 |
commit | 9ee1942cb3a8e1f9d413eaa34221d1a70ee13146 (patch) | |
tree | 4f4e929241c43b9e4b2b57edba4f0543c125b0c8 /drivers/net/netdevsim/netdev.c | |
parent | afb4c97d90e62f33b9f389aa0023f8478bb89db2 (diff) | |
download | linux-9ee1942cb3a8e1f9d413eaa34221d1a70ee13146.tar.xz |
netdevsim: correctly check return value of debugfs_create_dir
- Checking return value with IS_ERROR_OR_NULL
- Added error handling where it was not handled
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
-rw-r--r-- | drivers/net/netdevsim/netdev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 92678f55ee80..3fd567928f3d 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -151,6 +151,8 @@ static int nsim_init(struct net_device *dev) ns->netdev = dev; ns->ddir = debugfs_create_dir(netdev_name(dev), nsim_ddir); + if (IS_ERR_OR_NULL(ns->ddir)) + return -ENOMEM; err = nsim_bpf_init(ns); if (err) @@ -469,8 +471,8 @@ 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); + if (IS_ERR_OR_NULL(nsim_ddir)) + return -ENOMEM; err = bus_register(&nsim_bus); if (err) |