From: Frantisek Sumsal Date: Mon, 25 Dec 2023 17:12:59 +0000 (+0100) Subject: modules-load: simplify OOM check X-Git-Tag: v256-rc1~1384^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b3c27089685b9c886394cd085593a1d75f3cc30;p=thirdparty%2Fsystemd.git modules-load: simplify OOM check --- diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c index efca2379eac..da7e3d89005 100644 --- a/src/modules-load/modules-load.c +++ b/src/modules-load/modules-load.c @@ -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);