Skip to content

Commit 5c2d6a5

Browse files
committed
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 <[email protected]> Cc: Herbert Xu <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 492c887 commit 5c2d6a5

File tree

2 files changed

+11
-32
lines changed

2 files changed

+11
-32
lines changed

drivers/crypto/hisilicon/qm.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -963,13 +963,11 @@ static const struct file_operations qm_regs_fops = {
963963

964964
static int qm_create_debugfs_file(struct hisi_qm *qm, enum qm_debug_file index)
965965
{
966-
struct dentry *qm_d = qm->debug.qm_d, *tmp;
966+
struct dentry *qm_d = qm->debug.qm_d;
967967
struct debugfs_file *file = qm->debug.files + index;
968968

969-
tmp = debugfs_create_file(qm_debug_file_name[index], 0600, qm_d, file,
970-
&qm_debug_fops);
971-
if (IS_ERR(tmp))
972-
return -ENOENT;
969+
debugfs_create_file(qm_debug_file_name[index], 0600, qm_d, file,
970+
&qm_debug_fops);
973971

974972
file->index = index;
975973
mutex_init(&file->lock);
@@ -1780,12 +1778,10 @@ EXPORT_SYMBOL_GPL(hisi_qm_stop);
17801778
*/
17811779
int hisi_qm_debug_init(struct hisi_qm *qm)
17821780
{
1783-
struct dentry *qm_d, *qm_regs;
1781+
struct dentry *qm_d;
17841782
int i, ret;
17851783

17861784
qm_d = debugfs_create_dir("qm", qm->debug.debug_root);
1787-
if (IS_ERR(qm_d))
1788-
return -ENOENT;
17891785
qm->debug.qm_d = qm_d;
17901786

17911787
/* only show this in PF */
@@ -1796,12 +1792,7 @@ int hisi_qm_debug_init(struct hisi_qm *qm)
17961792
goto failed_to_create;
17971793
}
17981794

1799-
qm_regs = debugfs_create_file("qm_regs", 0444, qm->debug.qm_d, qm,
1800-
&qm_regs_fops);
1801-
if (IS_ERR(qm_regs)) {
1802-
ret = -ENOENT;
1803-
goto failed_to_create;
1804-
}
1795+
debugfs_create_file("qm_regs", 0444, qm->debug.qm_d, qm, &qm_regs_fops);
18051796

18061797
return 0;
18071798

drivers/crypto/hisilicon/zip/zip_main.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl)
511511
struct hisi_qm *qm = &hisi_zip->qm;
512512
struct device *dev = &qm->pdev->dev;
513513
struct debugfs_regset32 *regset;
514-
struct dentry *tmp_d, *tmp;
514+
struct dentry *tmp_d;
515515
char buf[HZIP_BUF_SIZE];
516516
int i;
517517

@@ -521,10 +521,6 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl)
521521
else
522522
sprintf(buf, "decomp_core%d", i - HZIP_COMP_CORE_NUM);
523523

524-
tmp_d = debugfs_create_dir(buf, ctrl->debug_root);
525-
if (!tmp_d)
526-
return -ENOENT;
527-
528524
regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
529525
if (!regset)
530526
return -ENOENT;
@@ -533,29 +529,25 @@ static int hisi_zip_core_debug_init(struct hisi_zip_ctrl *ctrl)
533529
regset->nregs = ARRAY_SIZE(hzip_dfx_regs);
534530
regset->base = qm->io_base + core_offsets[i];
535531

536-
tmp = debugfs_create_regset32("regs", 0444, tmp_d, regset);
537-
if (!tmp)
538-
return -ENOENT;
532+
tmp_d = debugfs_create_dir(buf, ctrl->debug_root);
533+
debugfs_create_regset32("regs", 0444, tmp_d, regset);
539534
}
540535

541536
return 0;
542537
}
543538

544539
static int hisi_zip_ctrl_debug_init(struct hisi_zip_ctrl *ctrl)
545540
{
546-
struct dentry *tmp;
547541
int i;
548542

549543
for (i = HZIP_CURRENT_QM; i < HZIP_DEBUG_FILE_NUM; i++) {
550544
spin_lock_init(&ctrl->files[i].lock);
551545
ctrl->files[i].ctrl = ctrl;
552546
ctrl->files[i].index = i;
553547

554-
tmp = debugfs_create_file(ctrl_debug_file_name[i], 0600,
555-
ctrl->debug_root, ctrl->files + i,
556-
&ctrl_debug_fops);
557-
if (!tmp)
558-
return -ENOENT;
548+
debugfs_create_file(ctrl_debug_file_name[i], 0600,
549+
ctrl->debug_root, ctrl->files + i,
550+
&ctrl_debug_fops);
559551
}
560552

561553
return hisi_zip_core_debug_init(ctrl);
@@ -569,8 +561,6 @@ static int hisi_zip_debugfs_init(struct hisi_zip *hisi_zip)
569561
int ret;
570562

571563
dev_d = debugfs_create_dir(dev_name(dev), hzip_debugfs_root);
572-
if (!dev_d)
573-
return -ENOENT;
574564

575565
qm->debug.debug_root = dev_d;
576566
ret = hisi_qm_debug_init(qm);
@@ -955,8 +945,6 @@ static void hisi_zip_register_debugfs(void)
955945
return;
956946

957947
hzip_debugfs_root = debugfs_create_dir("hisi_zip", NULL);
958-
if (IS_ERR_OR_NULL(hzip_debugfs_root))
959-
hzip_debugfs_root = NULL;
960948
}
961949

962950
static void hisi_zip_unregister_debugfs(void)

0 commit comments

Comments
 (0)