From: David Disseldorp Date: Wed, 26 Jul 2023 13:49:41 +0000 (+0200) Subject: refactor(install): log about missing firmware only once X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fdracut.git;a=commitdiff_plain;h=16855765c8ad9d3237e6d98e59d0f8e6d4c7fc62 refactor(install): log about missing firmware only once 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 --- diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index a945e3fd5..5cfcf5170 100644 --- a/src/install/dracut-install.c +++ b/src/install/dracut-install.c @@ -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; }