toolbox/modprobe: Fix failure due to blocklist
When a module is blocklisted, LoadWithAliases() will return an error
indicating the module failed to load. When the blocklist is requested
(via the -b parameter), let's not return an error if a blocklisted
module fails to load.
Test: verified lsmod on pixel 6
Bug: 324018983
Change-Id: I68f7d46bf9fd99e4b4e51ef92ea71686907f1125
diff --git a/toolbox/modprobe.cpp b/toolbox/modprobe.cpp
index 17d4e31..56cf140 100644
--- a/toolbox/modprobe.cpp
+++ b/toolbox/modprobe.cpp
@@ -257,6 +257,7 @@
switch (mode) {
case AddModulesMode:
if (!m.LoadWithAliases(module, true, module_parameters)) {
+ if (m.IsBlocklisted(module)) continue;
PLOG(ERROR) << "Failed to load module " << module;
rv = EXIT_FAILURE;
}