genwq: 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: Frank Haverkamp <haver@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2019-06-11 20:41:07 +02:00
parent 7e9f02a789
commit d7ef4857d9
4 changed files with 32 additions and 146 deletions

View File

@ -1377,10 +1377,6 @@ static int __init genwqe_init_module(void)
class_genwqe->devnode = genwqe_devnode;
debugfs_genwqe = debugfs_create_dir(GENWQE_DEVNAME, NULL);
if (!debugfs_genwqe) {
rc = -ENOMEM;
goto err_out;
}
rc = pci_register_driver(&genwqe_driver);
if (rc != 0) {
@ -1392,7 +1388,6 @@ static int __init genwqe_init_module(void)
err_out0:
debugfs_remove(debugfs_genwqe);
err_out:
class_destroy(class_genwqe);
return rc;
}

View File

@ -445,7 +445,7 @@ int genwqe_device_create(struct genwqe_dev *cd);
int genwqe_device_remove(struct genwqe_dev *cd);
/* debugfs */
int genwqe_init_debugfs(struct genwqe_dev *cd);
void genwqe_init_debugfs(struct genwqe_dev *cd);
void genqwe_exit_debugfs(struct genwqe_dev *cd);
int genwqe_read_softreset(struct genwqe_dev *cd);

View File

@ -324,11 +324,9 @@ static int info_show(struct seq_file *s, void *unused)
DEFINE_SHOW_ATTRIBUTE(info);
int genwqe_init_debugfs(struct genwqe_dev *cd)
void genwqe_init_debugfs(struct genwqe_dev *cd)
{
struct dentry *root;
struct dentry *file;
int ret;
char card_name[64];
char name[64];
unsigned int i;
@ -336,153 +334,50 @@ int genwqe_init_debugfs(struct genwqe_dev *cd)
sprintf(card_name, "%s%d_card", GENWQE_DEVNAME, cd->card_idx);
root = debugfs_create_dir(card_name, cd->debugfs_genwqe);
if (!root) {
ret = -ENOMEM;
goto err0;
}
/* non privileged interfaces are done here */
file = debugfs_create_file("ddcb_info", S_IRUGO, root, cd,
&ddcb_info_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("info", S_IRUGO, root, cd,
&info_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_x64("err_inject", 0666, root, &cd->err_inject);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_u32("ddcb_software_timeout", 0666, root,
&cd->ddcb_software_timeout);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_u32("kill_timeout", 0666, root,
&cd->kill_timeout);
if (!file) {
ret = -ENOMEM;
goto err1;
}
debugfs_create_file("ddcb_info", S_IRUGO, root, cd, &ddcb_info_fops);
debugfs_create_file("info", S_IRUGO, root, cd, &info_fops);
debugfs_create_x64("err_inject", 0666, root, &cd->err_inject);
debugfs_create_u32("ddcb_software_timeout", 0666, root,
&cd->ddcb_software_timeout);
debugfs_create_u32("kill_timeout", 0666, root, &cd->kill_timeout);
/* privileged interfaces follow here */
if (!genwqe_is_privileged(cd)) {
cd->debugfs_root = root;
return 0;
return;
}
file = debugfs_create_file("curr_regs", S_IRUGO, root, cd,
&curr_regs_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd,
&curr_dbg_uid0_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd,
&curr_dbg_uid1_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd,
&curr_dbg_uid2_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("prev_regs", S_IRUGO, root, cd,
&prev_regs_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd,
&prev_dbg_uid0_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd,
&prev_dbg_uid1_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd,
&prev_dbg_uid2_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
debugfs_create_file("curr_regs", S_IRUGO, root, cd, &curr_regs_fops);
debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd,
&curr_dbg_uid0_fops);
debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd,
&curr_dbg_uid1_fops);
debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd,
&curr_dbg_uid2_fops);
debugfs_create_file("prev_regs", S_IRUGO, root, cd, &prev_regs_fops);
debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd,
&prev_dbg_uid0_fops);
debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd,
&prev_dbg_uid1_fops);
debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd,
&prev_dbg_uid2_fops);
for (i = 0; i < GENWQE_MAX_VFS; i++) {
sprintf(name, "vf%u_jobtimeout_msec", i);
file = debugfs_create_u32(name, 0666, root,
&cd->vf_jobtimeout_msec[i]);
if (!file) {
ret = -ENOMEM;
goto err1;
}
debugfs_create_u32(name, 0666, root,
&cd->vf_jobtimeout_msec[i]);
}
file = debugfs_create_file("jobtimer", S_IRUGO, root, cd,
&jtimer_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_file("queue_working_time", S_IRUGO, root, cd,
&queue_working_time_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_u32("skip_recovery", 0666, root,
&cd->skip_recovery);
if (!file) {
ret = -ENOMEM;
goto err1;
}
file = debugfs_create_u32("use_platform_recovery", 0666, root,
&cd->use_platform_recovery);
if (!file) {
ret = -ENOMEM;
goto err1;
}
debugfs_create_file("jobtimer", S_IRUGO, root, cd, &jtimer_fops);
debugfs_create_file("queue_working_time", S_IRUGO, root, cd,
&queue_working_time_fops);
debugfs_create_u32("skip_recovery", 0666, root, &cd->skip_recovery);
debugfs_create_u32("use_platform_recovery", 0666, root,
&cd->use_platform_recovery);
cd->debugfs_root = root;
return 0;
err1:
debugfs_remove_recursive(root);
err0:
return ret;
}
void genqwe_exit_debugfs(struct genwqe_dev *cd)

View File

@ -1307,14 +1307,10 @@ int genwqe_device_create(struct genwqe_dev *cd)
goto err_cdev;
}
rc = genwqe_init_debugfs(cd);
if (rc != 0)
goto err_debugfs;
genwqe_init_debugfs(cd);
return 0;
err_debugfs:
device_destroy(cd->class_genwqe, cd->devnum_genwqe);
err_cdev:
cdev_del(&cd->cdev_genwqe);
err_add: