Skip to content

Commit

Permalink
firmware_loader: make firmware_fallback_sysfs() print more useful
Browse files Browse the repository at this point in the history
If we resort to using the sysfs fallback mechanism we don't print
the filename. This can be deceiving given we could have a series of
callers intertwined and it'd be unclear exactly for what firmware
this was meant for.

Additionally, although we don't currently use FW_OPT_NO_WARN when
dealing with the fallback mechanism, we will soon, so just respect
its use consistently.

And even if you *don't* want to print always on failure, you may
want to print when debugging so enable dynamic debug print when
FW_OPT_NO_WARN is used.

Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mcgrof authored and gregkh committed May 14, 2018
1 parent 06bfd3c commit 27d5d7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/base/firmware_loader/fallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,11 @@ int firmware_fallback_sysfs(struct firmware *fw, const char *name,
if (!fw_run_sysfs_fallback(opt_flags))
return ret;

dev_warn(device, "Falling back to user helper\n");
if (!(opt_flags & FW_OPT_NO_WARN))
dev_warn(device, "Falling back to syfs fallback for: %s\n",
name);
else
dev_dbg(device, "Falling back to sysfs fallback for: %s\n",
name);
return fw_load_from_user_helper(fw, name, device, opt_flags);
}

0 comments on commit 27d5d7d

Please sign in to comment.