Skip to content

Commit

Permalink
module: fix redundant test.
Browse files Browse the repository at this point in the history
[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 c988d2b
"modules: add version and srcversion to sysfs".

Reported-by: David Binderman <[email protected]>
Cc: Matt Domsch <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jul 27, 2016
1 parent bf262dc commit c75b590
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1693,8 +1693,7 @@ static int module_add_modinfo_attrs(struct module *mod)

temp_attr = mod->modinfo_attrs;
for (i = 0; (attr = modinfo_attrs[i]) && !error; i++) {
if (!attr->test ||
(attr->test && attr->test(mod))) {
if (!attr->test || attr->test(mod)) {
memcpy(temp_attr, attr, sizeof(*temp_attr));
sysfs_attr_init(&temp_attr->attr);
error = sysfs_create_file(&mod->mkobj.kobj,
Expand Down

0 comments on commit c75b590

Please sign in to comment.