Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(install): log about missing firmware only once #2461

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/install/dracut-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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",
Copy link
Collaborator

@LaszloGombos LaszloGombos Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, why did you remove "Possible" from the log message ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd assumed that "possible missing firmware" indicated that the search was not (yet) exhaustive. I.e. it's not present in this firmware subdir, but might show up in a different one.
With the new logic we've checked all available firmwaredirs and can conclusively state that the firmware is not found.

Thanks for the review!

value, kmod_module_get_name(mod));
}
}
return 0;
}
Expand Down
Loading