]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
modules-load: simplify OOM check
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Dec 2023 17:12:59 +0000 (18:12 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Dec 2023 17:26:59 +0000 (18:26 +0100)
src/modules-load/modules-load.c

index efca2379eac71e5850cfaa897e6fd166e55048c8..da7e3d890055550b370dfea691852d356a02457b 100644 (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);