diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2016-04-11 15:33:09 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2016-07-26 23:08:00 -0400 |
commit | c75b590d60ffa3e31bcb9608b68006a8bab9e0ed (patch) | |
tree | 7e67e27d736823cf0dfda9cd777ea1db569bf974 | |
parent | bf262dcec6383188a3324192c4a7e405b3b1ad23 (diff) |
module: fix redundant test.
[linux-4.5-rc4/kernel/module.c:1692]: (style) Redundant condition: attr.test.
'!attr.test || (attr.test && attr.test(mod))' is equivalent to '!attr.test ||
attr.test(mod)'
This code was added like this ten years ago, in c988d2b284549
"modules: add version and srcversion to sysfs".
Reported-by: David Binderman <dcb314@hotmail.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | kernel/module.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/module.c b/kernel/module.c index 5e876977844b..9e04a4210a4a 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1693,8 +1693,7 @@ static int module_add_modinfo_attrs(struct module *mod) | |||
1693 | 1693 | ||
1694 | temp_attr = mod->modinfo_attrs; | 1694 | temp_attr = mod->modinfo_attrs; |
1695 | for (i = 0; (attr = modinfo_attrs[i]) && !error; i++) { | 1695 | for (i = 0; (attr = modinfo_attrs[i]) && !error; i++) { |
1696 | if (!attr->test || | 1696 | if (!attr->test || attr->test(mod)) { |
1697 | (attr->test && attr->test(mod))) { | ||
1698 | memcpy(temp_attr, attr, sizeof(*temp_attr)); | 1697 | memcpy(temp_attr, attr, sizeof(*temp_attr)); |
1699 | sysfs_attr_init(&temp_attr->attr); | 1698 | sysfs_attr_init(&temp_attr->attr); |
1700 | error = sysfs_create_file(&mod->mkobj.kobj, | 1699 | error = sysfs_create_file(&mod->mkobj.kobj, |