summary refs log tree commit diff
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice via Guix-patches via <guix-patches@gnu.org>2021-12-15 01:47:04 +0100
committerLeo Famulari <leo@famulari.name>2021-12-16 12:53:52 -0500
commit13f13554433c9dd47503131107dfbdd8a8031832 (patch)
tree52b5f165f93b31cd9aa939a8fdebc5b98bc11e7b
parentbc09e7ab569d5306ce99c5525150695c9d539ef0 (diff)
downloadguix-13f13554433c9dd47503131107dfbdd8a8031832.tar.gz
linux-modules: Ignore EINVAL in ‘modprobe’ mode.
Loading the framebuffer-coreboot module simply fails with EINVAL on a
non-Corebooted system.  Crashing the system with a kernel panic is not
a reasonable reaction to loading valid modules on unsupported hardware.
The kernel should log an error, which the user is expected to see.

Bogus module names will still be fatally reported by linux-modules.drv.

* gnu/build/linux-modules.scm (load-linux-module*):
Ignore EINVAL errors when operating recursively.
-rw-r--r--gnu/build/linux-modules.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 3a47322065..053720574b 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -354,11 +354,13 @@ appears in BLACK-LIST are not loaded."
              (close-fdes fd)
              #t)
            (lambda args
-             ;; If this module was already loaded and we're in modprobe style, ignore
-             ;; the error.
              (when fd (close-fdes fd))
-             (or (and recursive? (= EEXIST (system-error-errno args)))
-                 (apply throw args)))))))
+             (let ((errno (system-error-errno args)))
+               (or (and recursive?      ; we're operating in ‘modprobe’ style
+                        (member errno
+                                (list EEXIST    ; already loaded
+                                      EINVAL))) ; unsupported by hardware
+                   (apply throw args))))))))
 
 (define (load-linux-modules-from-directory modules directory)
   "Load MODULES and their dependencies from DIRECTORY, a directory containing