}
} else {
DBG("Modprobe successfully %s", modules[i].name);
+ modules[i].loaded = true;
}
kmod_module_unref(mod);
for (i = entries - 1; i >= 0; i--) {
struct kmod_module *mod = NULL;
+ if (!modules[i].loaded) {
+ continue;
+ }
+
ret = kmod_module_new_from_name(ctx, modules[i].name, &mod);
if (ret < 0) {
PERROR("Failed to create kmod module for %s", modules[i].name);
}
} else {
DBG("Modprobe successfully %s", modules[i].name);
+ modules[i].loaded;
}
}
char modprobe[256];
for (i = entries - 1; i >= 0; i--) {
+ if (!modules[i].loaded) {
+ continue;
+ }
ret = snprintf(modprobe, sizeof(modprobe),
"/sbin/modprobe -r -q %s",
modules[i].name);