History

wimax: 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. This cleans up a lot of unneeded code and logic around the debugfs wimax files, making all of this much simpler and easier to understand.

Greg Kroah-Hartman committed 7 years ago

Commit a62052b1 parent 38b9e0f8 files · +51 −257Browse files

Showing the changes to include/linux (1 of 8 files). Show all

Unified · Split

include/linux/wimax/debug.h+3−17
@@ -98,9 +98,7 @@ · 97 unmodified lines
98 * To manipulate from user space the levels, create a debugfs dentry98 * To manipulate from user space the levels, create a debugfs dentry
99 * and then register each submodule with:99 * and then register each submodule with:
100 *100 *
101 * result = d_level_register_debugfs("PREFIX_", submodule_X, parent);101 * d_level_register_debugfs("PREFIX_", submodule_X, parent);
102 * if (result < 0)
103 * goto error;
104 *102 *
105 * Where PREFIX_ is a name of your chosing. This will create debugfs103 * Where PREFIX_ is a name of your chosing. This will create debugfs
106 * file with a single numeric value that can be use to tweak it. To104 * file with a single numeric value that can be use to tweak it. To
@@ -408,25 +406,13 @@ do { \ · 301 unmodified lines
408 * @submodule: name of submodule (not a string, just the name)406 * @submodule: name of submodule (not a string, just the name)
409 * @dentry: debugfs parent dentry407 * @dentry: debugfs parent dentry
410 *408 *
411 * Returns: 0 if ok, < 0 errno on error.
412 *
413 * For removing, just use debugfs_remove_recursive() on the parent.409 * For removing, just use debugfs_remove_recursive() on the parent.
414 */410 */
415#define d_level_register_debugfs(prefix, name, parent) \411#define d_level_register_debugfs(prefix, name, parent) \
416({ \412({ \
417 int rc; \413 debugfs_create_u8( \
418 struct dentry *fd; \414 prefix #name, 0600, parent, \
419 struct dentry *verify_parent_type = parent; \
420 fd = debugfs_create_u8( \
421 prefix #name, 0600, verify_parent_type, \
422 &(D_LEVEL[__D_SUBMODULE_ ## name].level)); \415 &(D_LEVEL[__D_SUBMODULE_ ## name].level)); \
423 rc = PTR_ERR(fd); \
424 if (IS_ERR(fd) && rc != -ENODEV) \
425 printk(KERN_ERR "%s: Can't create debugfs entry %s: " \
426 "%d\n", __func__, prefix #name, rc); \
427 else \
428 rc = 0; \
429 rc; \
430})416})
431 417
432 418

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t