Commit 5c2d6a52 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

crypto: hisilicon: 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: Zhou Wang <wangzhou1@hisilicon.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20191107085200.GB1274176@kroah.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 492c8872
...@@ -963,13 +963,11 @@ static const struct file_operations qm_regs_fops = { ...@@ -963,13 +963,11 @@ static const struct file_operations qm_regs_fops = {
static int qm_create_debugfs_file(struct hisi_qm *qm, enum qm_debug_file index) static int qm_create_debugfs_file(struct hisi_qm *qm, enum qm_debug_file index)
{ {
struct dentry *qm_d = qm->debug.qm_d, *tmp; struct dentry *qm_d = qm->debug.qm_d;
struct debugfs_file *file = qm->debug.files + index; struct debugfs_file *file = qm->debug.files + index;
tmp = debugfs_create_file(qm_debug_file_name[index], 0600, qm_d, file, debugfs_create_file(qm_debug_file_name[index], 0600, qm_d, file,
&qm_debug_fops); &qm_debug_fops);
if (IS_ERR(tmp))
return -ENOENT;
file->index = index; file->index = index;
mutex_init(&file->lock); mutex_init(&file->lock);
...@@ -1780,12 +1778,10 @@ EXPORT_SYMBOL_GPL(hisi_qm_stop); ...@@ -1780,12 +1778,10 @@ EXPORT_SYMBOL_GPL(hisi_qm_stop);
*/ */
int hisi_qm_debug_init(struct hisi_qm *qm) int hisi_qm_debug_init(struct hisi_qm *qm)
{ {
struct dentry *qm_d, *qm_regs; struct dentry *qm_d;
int i, ret; int i, ret;
qm_d = debugfs_create_dir("qm", qm->debug.debug_root); qm_d = debugfs_create_dir("qm", qm->debug.debug_root);
if (IS_ERR(qm_d))
return -ENOENT;
qm->debug.qm_d = qm_d; qm->debug.qm_d = qm_d;
/* only show this in PF */ /* only show this in PF */
...@@ -1796,12 +1792,7 @@ int hisi_qm_debug_init(struct hisi_qm *qm) ...@@ -1796,12 +1792,7 @@ int hisi_qm_debug_init(struct hisi_qm *qm)
goto failed_to_create; goto failed_to_create;
} }
qm_regs = debugfs_create_file("qm_regs", 0444, qm->debug.qm_d, qm, debugfs_create_file("qm_regs", 0444, qm->debug.qm_d, qm, &qm_regs_fops);
&qm_regs_fops);
if (IS_ERR(qm_regs)) {
ret = -ENOENT;
goto failed_to_create;
}
return 0; return 0;
......
...@@ -511,7 +511,7 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl) ...@@ -511,7 +511,7 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl)
struct hisi_qm *qm = &hisi_zip->qm; struct hisi_qm *qm = &hisi_zip->qm;
struct device *dev = &qm->pdev->dev; struct device *dev = &qm->pdev->dev;
struct debugfs_regset32 *regset; struct debugfs_regset32 *regset;
struct dentry *tmp_d, *tmp; struct dentry *tmp_d;
char buf[HZIP_BUF_SIZE]; char buf[HZIP_BUF_SIZE];
int i; int i;
...@@ -521,10 +521,6 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl) ...@@ -521,10 +521,6 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl)
else else
sprintf(buf, "decomp_core%d", i - HZIP_COMP_CORE_NUM); sprintf(buf, "decomp_core%d", i - HZIP_COMP_CORE_NUM);
tmp_d = debugfs_create_dir(buf, ctrl->debug_root);
if (!tmp_d)
return -ENOENT;
regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
if (!regset) if (!regset)
return -ENOENT; return -ENOENT;
...@@ -533,9 +529,8 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl) ...@@ -533,9 +529,8 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl)
regset->nregs = ARRAY_SIZE(hzip_dfx_regs); regset->nregs = ARRAY_SIZE(hzip_dfx_regs);
regset->base = qm->io_base + core_offsets[i]; regset->base = qm->io_base + core_offsets[i];
tmp = debugfs_create_regset32("regs", 0444, tmp_d, regset); tmp_d = debugfs_create_dir(buf, ctrl->debug_root);
if (!tmp) debugfs_create_regset32("regs", 0444, tmp_d, regset);
return -ENOENT;
} }
return 0; return 0;
...@@ -543,7 +538,6 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl) ...@@ -543,7 +538,6 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl)
static int hisi_zip_ctrl_debug_init(struct hisi_zip_ctrl *ctrl) static int hisi_zip_ctrl_debug_init(struct hisi_zip_ctrl *ctrl)
{ {
struct dentry *tmp;
int i; int i;
for (i = HZIP_CURRENT_QM; i < HZIP_DEBUG_FILE_NUM; i++) { for (i = HZIP_CURRENT_QM; i < HZIP_DEBUG_FILE_NUM; i++) {
...@@ -551,11 +545,9 @@ static int hisi_zip_ctrl_debug_init(struct hisi_zip_ctrl *ctrl) ...@@ -551,11 +545,9 @@ static int hisi_zip_ctrl_debug_init(struct hisi_zip_ctrl *ctrl)
ctrl->files[i].ctrl = ctrl; ctrl->files[i].ctrl = ctrl;
ctrl->files[i].index = i; ctrl->files[i].index = i;
tmp = debugfs_create_file(ctrl_debug_file_name[i], 0600, debugfs_create_file(ctrl_debug_file_name[i], 0600,
ctrl->debug_root, ctrl->files + i, ctrl->debug_root, ctrl->files + i,
&ctrl_debug_fops); &ctrl_debug_fops);
if (!tmp)
return -ENOENT;
} }
return hisi_zip_core_debug_init(ctrl); return hisi_zip_core_debug_init(ctrl);
...@@ -569,8 +561,6 @@ static int hisi_zip_debugfs_init(struct hisi_zip *hisi_zip) ...@@ -569,8 +561,6 @@ static int hisi_zip_debugfs_init(struct hisi_zip *hisi_zip)
int ret; int ret;
dev_d = debugfs_create_dir(dev_name(dev), hzip_debugfs_root); dev_d = debugfs_create_dir(dev_name(dev), hzip_debugfs_root);
if (!dev_d)
return -ENOENT;
qm->debug.debug_root = dev_d; qm->debug.debug_root = dev_d;
ret = hisi_qm_debug_init(qm); ret = hisi_qm_debug_init(qm);
...@@ -955,8 +945,6 @@ static void hisi_zip_register_debugfs(void) ...@@ -955,8 +945,6 @@ static void hisi_zip_register_debugfs(void)
return; return;
hzip_debugfs_root = debugfs_create_dir("hisi_zip", NULL); hzip_debugfs_root = debugfs_create_dir("hisi_zip", NULL);
if (IS_ERR_OR_NULL(hzip_debugfs_root))
hzip_debugfs_root = NULL;
} }
static void hisi_zip_unregister_debugfs(void) static void hisi_zip_unregister_debugfs(void)
......
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