mirror of
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
synced 2024-11-26 21:33:42 +08:00
libkmod: Unify kmod_module_new_from_* functions
Return result of kmod_module_new directly in kmod_module_new_from_alias so this function handles return values like the others. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: https://github.com/kmod-project/kmod/pull/211 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This commit is contained in:
parent
d090fb3ae5
commit
4891b4b095
@ -291,7 +291,6 @@ KMOD_EXPORT int kmod_module_new_from_name(struct kmod_ctx *ctx, const char *name
|
||||
int kmod_module_new_from_alias(struct kmod_ctx *ctx, const char *alias, const char *name,
|
||||
struct kmod_module **mod)
|
||||
{
|
||||
int err;
|
||||
char key[PATH_MAX];
|
||||
size_t namelen = strlen(name);
|
||||
size_t aliaslen = strlen(alias);
|
||||
@ -303,11 +302,7 @@ int kmod_module_new_from_alias(struct kmod_ctx *ctx, const char *alias, const ch
|
||||
memcpy(key + namelen + 1, alias, aliaslen + 1);
|
||||
key[namelen] = '\\';
|
||||
|
||||
err = kmod_module_new(ctx, key, name, namelen, alias, aliaslen, mod);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
return kmod_module_new(ctx, key, name, namelen, alias, aliaslen, mod);
|
||||
}
|
||||
|
||||
KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx, const char *path,
|
||||
|
Loading…
Reference in New Issue
Block a user