mirror of
https://github.com/systemd/systemd
synced 2024-07-22 02:34:54 +00:00
kmod_module_probe_insert_module returns 0 on success, != 0 on failure
More specifically, it should return > 0 only for conditions specified in probe_flags. We only set KMOD_PROBE_APPLY_BLACKLIST in probe_flags, so the code was correct, but add an assert to clarify this.
This commit is contained in:
parent
232ac0d681
commit
2c3f0bb207
|
@ -118,8 +118,9 @@ static int load_module(struct kmod_ctx *ctx, const char *m) {
|
|||
else if (err == KMOD_PROBE_APPLY_BLACKLIST)
|
||||
log_info("Module '%s' is blacklisted", kmod_module_get_name(mod));
|
||||
else {
|
||||
log_error_errno(err, "Failed to insert '%s': %m", kmod_module_get_name(mod));
|
||||
r = err;
|
||||
assert(err < 0);
|
||||
r = log_error_errno(err, "Failed to insert '%s': %m",
|
||||
kmod_module_get_name(mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ static int load_module(const char *mod_name) {
|
|||
|
||||
r = kmod_module_new_from_lookup(ctx, mod_name, &list);
|
||||
if (r < 0)
|
||||
return -1;
|
||||
return r;
|
||||
|
||||
kmod_list_foreach(l, list) {
|
||||
_cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
|
||||
|
@ -49,10 +49,8 @@ static int load_module(const char *mod_name) {
|
|||
mod = kmod_module_get_module(l);
|
||||
|
||||
r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL);
|
||||
if (r >= 0)
|
||||
r = 0;
|
||||
else
|
||||
r = -1;
|
||||
if (r > 0)
|
||||
r = -EINVAL;
|
||||
}
|
||||
|
||||
return r;
|
||||
|
|
Loading…
Reference in a new issue