modules-load: simplify OOM check

This commit is contained in:
Frantisek Sumsal 2023-12-25 18:12:59 +01:00
parent f2d0e2e5f5
commit 0b3c270896

View file

@ -172,10 +172,8 @@ static int run(int argc, char *argv[]) {
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
ctx = kmod_new(NULL, NULL);
if (!ctx) {
log_error("Failed to allocate memory for kmod.");
return -ENOMEM;
}
if (!ctx)
return log_oom();
kmod_load_resources(ctx);
kmod_set_log_fn(ctx, systemd_kmod_log, NULL);