x86/module: Remove unnecessary check in module_finalize()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 19 Feb 2025 13:48:49 +0000 (16:48 +0300)
committerIngo Molnar <mingo@kernel.org>
Fri, 21 Feb 2025 13:27:42 +0000 (14:27 +0100)
The "calls" pointer can no longer be NULL after the following
commit:

   ab9fea59487d ("x86/alternative: Simplify callthunk patching")

Delete this unnecessary check.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/fcbb2f57-0714-4139-b441-8817365c16a1@stanley.mountain
arch/x86/kernel/module.c

index cb9d295e67cbfee50944dc9bb7a6b0e3794e42a2..615f74c4bd6c0ffbe7abe308e9317019191e2941 100644 (file)
@@ -278,10 +278,8 @@ int module_finalize(const Elf_Ehdr *hdr,
        if (calls) {
                struct callthunk_sites cs = {};
 
-               if (calls) {
-                       cs.call_start = (void *)calls->sh_addr;
-                       cs.call_end = (void *)calls->sh_addr + calls->sh_size;
-               }
+               cs.call_start = (void *)calls->sh_addr;
+               cs.call_end = (void *)calls->sh_addr + calls->sh_size;
 
                callthunks_patch_module_calls(&cs, me);
        }