History

module: Fix ERRORs reported by checkpatch.pl

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,

Christophe Leroy committed 4 years ago

Commit ecc726f1 parent ae39e9e2 files · +7 −4Browse files

Unified · Split

2 files
  1. kernel/module/kallsyms.c +6 −3
  2. kernel/module/main.c +1 −1
kernel/module/kallsyms.c+6−3
@@ -466,14 +466,17 @@ unsigned long module_kallsyms_lookup_name(const char *name) · 465 unmodified lines
466466
467467 /* Don't lock: we're in enough trouble already. */
468468 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)
471473 ret = find_kallsyms_symbol_value(mod, colon + 1);
472474 } else {
473475 list_for_each_entry_rcu(mod, &modules, list) {
474476 if (mod->state == MODULE_STATE_UNFORMED)
475477 continue;
476− if ((ret = find_kallsyms_symbol_value(mod, name)) != 0)
478+ ret = find_kallsyms_symbol_value(mod, name);
479+ if (ret)
477480 break;
478481 }
479482 }
kernel/module/main.c+1−1
@@ -119,7 +119,7 @@ static void mod_update_bounds(struct module *mod) · 118 unmodified lines
119119 }
120120
121121 /* Block module loading/unloading? */
122−int modules_disabled = 0;
122+int modules_disabled;
123123 core_param(nomodule, modules_disabled, bint, 0);
124124
125125 /* Waiting for a module to finish initializing? */

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