diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2021-11-30 14:23:18 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2021-12-29 16:02:07 +0000 |
commit | 84a071479253dd525099e403164313f36aec3d79 (patch) | |
tree | 4dd0d56f3be36b41bd40454e622ccf8dcd1fc535 /sys/tools | |
parent | 1a305490732cdd30d19627b49847ebe09009a8f7 (diff) | |
download | src-84a071479253dd525099e403164313f36aec3d79.tar.gz src-84a071479253dd525099e403164313f36aec3d79.zip |
fw_stub: fix -Wunused-but-set-variable for firmware files
In case we are only embedding a single firmware image the variable
"parent" gets set but never used. Add checks for the number of files
for it and only print it out if we are exceeding the single file count.
This fixes -Wunused-but-set-variable warnings for the majority of
firmware files in the tree.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b394e16ef0b5ad0da5e029bcdd3a01e361724d8d)
Diffstat (limited to 'sys/tools')
-rw-r--r-- | sys/tools/fw_stub.awk | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/tools/fw_stub.awk b/sys/tools/fw_stub.awk index 807c51b6190b..94975687f4e2 100644 --- a/sys/tools/fw_stub.awk +++ b/sys/tools/fw_stub.awk @@ -151,8 +151,10 @@ for (file_i = 0; file_i < num_files; file_i++) { printc("\nstatic int\n"\ modname "_fw_modevent(module_t mod, int type, void *unused)\ {\ - const struct firmware *fp, *parent;\ - int error;\ + const struct firmware *fp;"); +if (num_files > 1) + printc("\tconst struct firmware *parent;"); +printc("\tint error;\ switch (type) {\ case MOD_LOAD:\n"); @@ -187,7 +189,7 @@ for (file_i = 0; file_i < num_files; file_i++) { printc("\t\tif (fp == NULL)"); printc("\t\t\tgoto fail_" file_i ";"); - if (file_i == 0) + if (file_i == 0 && num_files > 1) printc("\t\tparent = fp;"); } |