Message ID | YMCQXQx4kHdk7Whx@mwanda (mailing list archive) |
---|---|
State | Accepted |
Commit | 4e744cb8126deac52257219fad754614a61989da |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] netdevsim: delete unnecessary debugfs checking | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 3 of 3 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 37 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
Hello: This patch was applied to netdev/net-next.git (refs/heads/master): On Wed, 9 Jun 2021 12:56:45 +0300 you wrote: > In normal situations where the driver doesn't dereference > "nsim_node->ddir" or "nsim_node->rate_parent" itself then we are not > supposed to check the return from debugfs functions. In the case of > debugfs_create_dir() the check was wrong as well because it doesn't > return NULL, it returns error pointers. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > > [...] Here is the summary with links: - [net-next] netdevsim: delete unnecessary debugfs checking https://git.kernel.org/netdev/net-next/c/4e744cb8126d You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index 527b019ae0b2..6f4bc70049d2 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -1141,7 +1141,6 @@ static int nsim_rate_node_new(struct devlink_rate *node, void **priv, { struct nsim_dev *nsim_dev = devlink_priv(node->devlink); struct nsim_rate_node *nsim_node; - int err; if (!nsim_esw_mode_is_switchdev(nsim_dev)) { NL_SET_ERR_MSG_MOD(extack, "Node creation allowed only in switchdev mode."); @@ -1153,29 +1152,16 @@ static int nsim_rate_node_new(struct devlink_rate *node, void **priv, return -ENOMEM; nsim_node->ddir = debugfs_create_dir(node->name, nsim_dev->nodes_ddir); - if (!nsim_node->ddir) { - err = -ENOMEM; - goto err_node; - } + debugfs_create_u16("tx_share", 0400, nsim_node->ddir, &nsim_node->tx_share); debugfs_create_u16("tx_max", 0400, nsim_node->ddir, &nsim_node->tx_max); nsim_node->rate_parent = debugfs_create_file("rate_parent", 0400, nsim_node->ddir, &nsim_node->parent_name, &nsim_dev_rate_parent_fops); - if (IS_ERR(nsim_node->rate_parent)) { - err = PTR_ERR(nsim_node->rate_parent); - goto err_ddir; - } *priv = nsim_node; return 0; - -err_ddir: - debugfs_remove_recursive(nsim_node->ddir); -err_node: - kfree(nsim_node); - return err; } static int nsim_rate_node_del(struct devlink_rate *node, void *priv,
In normal situations where the driver doesn't dereference "nsim_node->ddir" or "nsim_node->rate_parent" itself then we are not supposed to check the return from debugfs functions. In the case of debugfs_create_dir() the check was wrong as well because it doesn't return NULL, it returns error pointers. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- drivers/net/netdevsim/dev.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)