Commit 09b0965e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

IB: mlx5: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-rdma@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b889b3b0
...@@ -5710,11 +5710,10 @@ static int mlx5_ib_rn_get_params(struct ib_device *device, u8 port_num, ...@@ -5710,11 +5710,10 @@ static int mlx5_ib_rn_get_params(struct ib_device *device, u8 port_num,
static void delay_drop_debugfs_cleanup(struct mlx5_ib_dev *dev) static void delay_drop_debugfs_cleanup(struct mlx5_ib_dev *dev)
{ {
if (!dev->delay_drop.dbg) if (!dev->delay_drop.dir_debugfs)
return; return;
debugfs_remove_recursive(dev->delay_drop.dbg->dir_debugfs); debugfs_remove_recursive(dev->delay_drop.dir_debugfs);
kfree(dev->delay_drop.dbg); dev->delay_drop.dir_debugfs = NULL;
dev->delay_drop.dbg = NULL;
} }
static void cancel_delay_drop(struct mlx5_ib_dev *dev) static void cancel_delay_drop(struct mlx5_ib_dev *dev)
...@@ -5765,52 +5764,22 @@ static const struct file_operations fops_delay_drop_timeout = { ...@@ -5765,52 +5764,22 @@ static const struct file_operations fops_delay_drop_timeout = {
.read = delay_drop_timeout_read, .read = delay_drop_timeout_read,
}; };
static int delay_drop_debugfs_init(struct mlx5_ib_dev *dev) static void delay_drop_debugfs_init(struct mlx5_ib_dev *dev)
{ {
struct mlx5_ib_dbg_delay_drop *dbg; struct dentry *root;
if (!mlx5_debugfs_root) if (!mlx5_debugfs_root)
return 0; return;
dbg = kzalloc(sizeof(*dbg), GFP_KERNEL);
if (!dbg)
return -ENOMEM;
dev->delay_drop.dbg = dbg;
dbg->dir_debugfs =
debugfs_create_dir("delay_drop",
dev->mdev->priv.dbg_root);
if (!dbg->dir_debugfs)
goto out_debugfs;
dbg->events_cnt_debugfs =
debugfs_create_atomic_t("num_timeout_events", 0400,
dbg->dir_debugfs,
&dev->delay_drop.events_cnt);
if (!dbg->events_cnt_debugfs)
goto out_debugfs;
dbg->rqs_cnt_debugfs =
debugfs_create_atomic_t("num_rqs", 0400,
dbg->dir_debugfs,
&dev->delay_drop.rqs_cnt);
if (!dbg->rqs_cnt_debugfs)
goto out_debugfs;
dbg->timeout_debugfs =
debugfs_create_file("timeout", 0600,
dbg->dir_debugfs,
&dev->delay_drop,
&fops_delay_drop_timeout);
if (!dbg->timeout_debugfs)
goto out_debugfs;
return 0; root = debugfs_create_dir("delay_drop", dev->mdev->priv.dbg_root);
dev->delay_drop.dir_debugfs = root;
out_debugfs: debugfs_create_atomic_t("num_timeout_events", 0400, root,
delay_drop_debugfs_cleanup(dev); &dev->delay_drop.events_cnt);
return -ENOMEM; debugfs_create_atomic_t("num_rqs", 0400, root,
&dev->delay_drop.rqs_cnt);
debugfs_create_file("timeout", 0600, root, &dev->delay_drop,
&fops_delay_drop_timeout);
} }
static void init_delay_drop(struct mlx5_ib_dev *dev) static void init_delay_drop(struct mlx5_ib_dev *dev)
...@@ -5826,8 +5795,7 @@ static void init_delay_drop(struct mlx5_ib_dev *dev) ...@@ -5826,8 +5795,7 @@ static void init_delay_drop(struct mlx5_ib_dev *dev)
atomic_set(&dev->delay_drop.rqs_cnt, 0); atomic_set(&dev->delay_drop.rqs_cnt, 0);
atomic_set(&dev->delay_drop.events_cnt, 0); atomic_set(&dev->delay_drop.events_cnt, 0);
if (delay_drop_debugfs_init(dev)) delay_drop_debugfs_init(dev);
mlx5_ib_warn(dev, "Failed to init delay drop debugfs\n");
} }
static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev, static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev,
......
...@@ -792,13 +792,6 @@ enum { ...@@ -792,13 +792,6 @@ enum {
MLX5_MAX_DELAY_DROP_TIMEOUT_MS = 100, MLX5_MAX_DELAY_DROP_TIMEOUT_MS = 100,
}; };
struct mlx5_ib_dbg_delay_drop {
struct dentry *dir_debugfs;
struct dentry *rqs_cnt_debugfs;
struct dentry *events_cnt_debugfs;
struct dentry *timeout_debugfs;
};
struct mlx5_ib_delay_drop { struct mlx5_ib_delay_drop {
struct mlx5_ib_dev *dev; struct mlx5_ib_dev *dev;
struct work_struct delay_drop_work; struct work_struct delay_drop_work;
...@@ -808,7 +801,7 @@ struct mlx5_ib_delay_drop { ...@@ -808,7 +801,7 @@ struct mlx5_ib_delay_drop {
bool activate; bool activate;
atomic_t events_cnt; atomic_t events_cnt;
atomic_t rqs_cnt; atomic_t rqs_cnt;
struct mlx5_ib_dbg_delay_drop *dbg; struct dentry *dir_debugfs;
}; };
enum mlx5_ib_stages { enum mlx5_ib_stages {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment