+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
#include "fileio.h"
#include "kmod-setup.h"
#include "macro.h"
+#include "module-util.h"
#include "string-util.h"
#if HAVE_KMOD
/* virtio_rng would be loaded by udev later, but real entropy might be needed very early */
{ "virtio_rng", NULL, false, false, has_virtio_rng },
};
- struct kmod_ctx *ctx = NULL;
+ _cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL;
unsigned int i;
int r;
return 0;
for (i = 0; i < ELEMENTSOF(kmod_table); i++) {
- struct kmod_module *mod;
+ _cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
if (kmod_table[i].path && access(kmod_table[i].path, F_OK) >= 0)
continue;
log_full_errno(print_warning ? LOG_WARNING : LOG_DEBUG, r,
"Failed to insert module '%s': %m", kmod_module_get_name(mod));
}
-
- kmod_module_unref(mod);
}
- if (ctx)
- kmod_unref(ctx);
-
#endif
return 0;
}