diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-22 16:21:03 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-01-22 19:45:52 +0100 |
commit | 9ec6dbfbdc0ade855e6bc1da66e263e0d926697c (patch) | |
tree | 4374d454e65f92450f588cb398ddff7e9b7247fc /drivers/acpi/ec_sys.c | |
parent | 49a57857aeea06ca831043acbb0fa5e0f50602fd (diff) | |
download | lwn-9ec6dbfbdc0ade855e6bc1da66e263e0d926697c.tar.gz lwn-9ec6dbfbdc0ade855e6bc1da66e263e0d926697c.zip |
ACPI: 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.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/ec_sys.c')
-rw-r--r-- | drivers/acpi/ec_sys.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c index dd70d6c2bca0..23faa66ea772 100644 --- a/drivers/acpi/ec_sys.c +++ b/drivers/acpi/ec_sys.c @@ -108,52 +108,32 @@ static const struct file_operations acpi_ec_io_ops = { .llseek = default_llseek, }; -static int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count) +static void acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count) { struct dentry *dev_dir; char name[64]; umode_t mode = 0400; - if (ec_device_count == 0) { + if (ec_device_count == 0) acpi_ec_debugfs_dir = debugfs_create_dir("ec", NULL); - if (!acpi_ec_debugfs_dir) - return -ENOMEM; - } sprintf(name, "ec%u", ec_device_count); dev_dir = debugfs_create_dir(name, acpi_ec_debugfs_dir); - if (!dev_dir) { - if (ec_device_count != 0) - goto error; - return -ENOMEM; - } - if (!debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe)) - goto error; - if (!debugfs_create_bool("use_global_lock", 0444, dev_dir, - &first_ec->global_lock)) - goto error; + debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe); + debugfs_create_bool("use_global_lock", 0444, dev_dir, + &first_ec->global_lock); if (write_support) mode = 0600; - if (!debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops)) - goto error; - - return 0; - -error: - debugfs_remove_recursive(acpi_ec_debugfs_dir); - return -ENOMEM; + debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops); } static int __init acpi_ec_sys_init(void) { - int err = 0; if (first_ec) - err = acpi_ec_add_debugfs(first_ec, 0); - else - err = -ENODEV; - return err; + acpi_ec_add_debugfs(first_ec, 0); + return 0; } static void __exit acpi_ec_sys_exit(void) |