]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
refactor(install): log about missing firmware only once
authorDavid Disseldorp <ddiss@suse.de>
Wed, 26 Jul 2023 13:49:41 +0000 (15:49 +0200)
committerAntonio Álvarez Feijoo <antonio.feijoo@suse.com>
Mon, 31 Jul 2023 08:29:06 +0000 (10:29 +0200)
When attempting to locate a firmware path under each of the firwaredirs
parent directories, Dracut logs an error for every missing path.
Instead, only log the error if the firmware path isn't found under any
of the firmwaredirs.

Signed-off-by: David Disseldorp <ddiss@suse.de>
src/install/dracut-install.c

index a945e3fd5985d3b95e9e1ff2c9c3f32431440f12..5cfcf51708f28bba3b7006e73f2be29683c712e3 100644 (file)
@@ -1396,7 +1396,6 @@ static int install_firmware(struct kmod_module *mod)
         struct kmod_list *l = NULL;
         _cleanup_kmod_module_info_free_list_ struct kmod_list *list = NULL;
         int ret;
-
         char **q;
 
         ret = kmod_module_get_info(mod, &list);
@@ -1407,6 +1406,7 @@ static int install_firmware(struct kmod_module *mod)
         kmod_list_foreach(l, list) {
                 const char *key = kmod_module_info_get_key(l);
                 const char *value = NULL;
+                bool found_this = false;
 
                 if (!streq("firmware", key))
                         continue;
@@ -1427,19 +1427,20 @@ static int install_firmware(struct kmod_module *mod)
                                 glob(fwpath, 0, NULL, &globbuf);
                                 for (i = 0; i < globbuf.gl_pathc; i++) {
                                         ret = install_firmware_fullpath(globbuf.gl_pathv[i]);
-                                        if (ret != 0) {
-                                                log_info("Possible missing firmware %s for kernel module %s", value,
-                                                         kmod_module_get_name(mod));
-                                        }
+                                        if (ret == 0)
+                                                found_this = true;
                                 }
                         } else {
                                 ret = install_firmware_fullpath(fwpath);
-                                if (ret != 0) {
-                                        log_info("Possible missing firmware %s for kernel module %s", value,
-                                                 kmod_module_get_name(mod));
-                                }
+                                if (ret == 0)
+                                        found_this = true;
                         }
                 }
+                if (!found_this) {
+                        /* firmware path was not found in any firmwaredirs */
+                        log_info("Missing firmware %s for kernel module %s",
+                                 value, kmod_module_get_name(mod));
+                }
         }
         return 0;
 }