module: Avoid unnecessary return value initialization in move_module()
authorPetr Pavlu <petr.pavlu@suse.com>
Wed, 18 Jun 2025 12:26:27 +0000 (14:26 +0200)
committerDaniel Gomez <da.gomez@samsung.com>
Tue, 8 Jul 2025 18:52:29 +0000 (20:52 +0200)
All error conditions in move_module() set the return value by updating the
ret variable. Therefore, it is not necessary to the initialize the variable
when declaring it.

Remove the unnecessary initialization.

Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
Link: https://lore.kernel.org/r/20250618122730.51324-3-petr.pavlu@suse.com
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Message-ID: <20250618122730.51324-3-petr.pavlu@suse.com>

kernel/module/main.c

index 9ac994b2f354a04ebf65f4924796f80012188b15..7822b91fca6b607bb066e3d4d9a01911b51ea132 100644 (file)
@@ -2696,9 +2696,8 @@ static int find_module_sections(struct module *mod, struct load_info *info)
 
 static int move_module(struct module *mod, struct load_info *info)
 {
-       int i;
+       int i, ret;
        enum mod_mem_type t = MOD_MEM_NUM_TYPES;
-       int ret = -ENOMEM;
        bool codetag_section_found = false;
 
        for_each_mod_mem_type(type) {