Checkpatch reports following errors: ERROR: do not use assignment in if condition + if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) { ERROR: do not use assignment in if condition + if ((mod = find_module_all(name, colon - name, false)) != NULL) ERROR: do not use assignment in if condition + if ((ret = find_kallsyms_symbol_value(mod, name)) != 0) ERROR: do not initialise globals to 0 +int modules_disabled = 0; Fix them. The following one has to remain, because the condition has to be evaluated multiple times by the macro wait_event_interruptible_timeout(). ERROR: do not use assignment in if condition + if (wait_event_interruptible_timeout(module_wq,
Showing the changes to kernel/module (2 of 2 files). Show all
Unified · Split
| @@ -466,14 +466,17 @@ unsigned long module_kallsyms_lookup_name(const char *name) · 465 unmodified lines | ||
| 466 | 466 | |
| 467 | 467 | /* Don't lock: we're in enough trouble already. */ |
| 468 | 468 | preempt_disable(); |
| 469 | − if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) { | |
| 470 | − if ((mod = find_module_all(name, colon - name, false)) != NULL) | |
| 469 | + colon = strnchr(name, MODULE_NAME_LEN, ':'); | |
| 470 | + if (colon) { | |
| 471 | + mod = find_module_all(name, colon - name, false); | |
| 472 | + if (mod) | |
| 471 | 473 | ret = find_kallsyms_symbol_value(mod, colon + 1); |
| 472 | 474 | } else { |
| 473 | 475 | list_for_each_entry_rcu(mod, &modules, list) { |
| 474 | 476 | if (mod->state == MODULE_STATE_UNFORMED) |
| 475 | 477 | continue; |
| 476 | − if ((ret = find_kallsyms_symbol_value(mod, name)) != 0) | |
| 478 | + ret = find_kallsyms_symbol_value(mod, name); | |
| 479 | + if (ret) | |
| 477 | 480 | break; |
| 478 | 481 | } |
| 479 | 482 | } |
| @@ -119,7 +119,7 @@ static void mod_update_bounds(struct module *mod) · 118 unmodified lines | ||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /* Block module loading/unloading? */ |
| 122 | −int modules_disabled = 0; | |
| 122 | +int modules_disabled; | |
| 123 | 123 | core_param(nomodule, modules_disabled, bint, 0); |
| 124 | 124 | |
| 125 | 125 | /* Waiting for a module to finish initializing? */ |