summaryrefslogtreecommitdiff
path: root/kernel/module/kallsyms.c
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2022-06-13 08:02:01 +0200
committerLuis Chamberlain <mcgrof@kernel.org>2022-07-11 10:49:14 -0700
commitecc726f1458e7aa50e120ff334f0a3be5cccd94c (patch)
tree404c2152837cfe5510664db6c77430bb2b5bca0f /kernel/module/kallsyms.c
parentae39e9ed964f8e450d0de410b5a757e19581dfc5 (diff)
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, Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'kernel/module/kallsyms.c')
-rw-r--r--kernel/module/kallsyms.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c
index 77e75bead569..6a74545fc8a1 100644
--- a/kernel/module/kallsyms.c
+++ b/kernel/module/kallsyms.c
@@ -466,14 +466,17 @@ unsigned long module_kallsyms_lookup_name(const char *name)
/* Don't lock: we're in enough trouble already. */
preempt_disable();
- if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) {
- if ((mod = find_module_all(name, colon - name, false)) != NULL)
+ colon = strnchr(name, MODULE_NAME_LEN, ':');
+ if (colon) {
+ mod = find_module_all(name, colon - name, false);
+ if (mod)
ret = find_kallsyms_symbol_value(mod, colon + 1);
} else {
list_for_each_entry_rcu(mod, &modules, list) {
if (mod->state == MODULE_STATE_UNFORMED)
continue;
- if ((ret = find_kallsyms_symbol_value(mod, name)) != 0)
+ ret = find_kallsyms_symbol_value(mod, name);
+ if (ret)
break;
}
}