mirror of
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
synced 2024-12-12 13:13:52 +08:00
libkmod: move kmod_file_load_contents as applicable
When dealing with an elf, we don't know or care about loading the file. The kmod_elf subsystem/API will deal with the required parts itself. Which in this case, already calls kmod_file_load_contents() as applicable. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This commit is contained in:
parent
81e5c797d0
commit
8cc475f7da
@ -903,10 +903,6 @@ static int do_init_module(struct kmod_module *mod, unsigned int flags,
|
||||
off_t size;
|
||||
int err;
|
||||
|
||||
err = kmod_file_load_contents(mod->file);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (flags & (KMOD_INSERT_FORCE_VERMAGIC | KMOD_INSERT_FORCE_MODVERSION)) {
|
||||
elf = kmod_file_get_elf(mod->file);
|
||||
if (elf == NULL) {
|
||||
@ -928,6 +924,10 @@ static int do_init_module(struct kmod_module *mod, unsigned int flags,
|
||||
|
||||
mem = kmod_elf_get_memory(elf);
|
||||
} else {
|
||||
err = kmod_file_load_contents(mod->file);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
mem = kmod_file_get_contents(mod->file);
|
||||
}
|
||||
size = kmod_file_get_size(mod->file);
|
||||
|
Loading…
Reference in New Issue
Block a user