diff options
author | Jaehoon Chung | 2022-10-13 17:41:21 +0900 |
---|---|---|
committer | Tom Rini | 2022-12-08 09:25:44 -0500 |
commit | c059a22b7776dc4306acb73cbeb78e841cf60b84 (patch) | |
tree | aaa2f77de5e4136cdd6533452f122bc84712c1dc /tools/env/fw_env.c | |
parent | 2b2e9127ccdacdd1170dfcd2a4f1794ff9446fb1 (diff) |
tools: env: fw_env: Fix unused-result warning
Fix unused-result warning about fread.
tools/env/fw_env.c: In function ‘find_nvmem_device’:
tools/env/fw_env.c:1751:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
1751 | fread(buf, sizeof(buf), 1, fp);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'tools/env/fw_env.c')
-rw-r--r-- | tools/env/fw_env.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index c251e2e6ba7..c9a8774acef 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1733,6 +1733,7 @@ static int find_nvmem_device(void) while (!nvmem && (dent = readdir(dir))) { FILE *fp; + size_t size; if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) { continue; @@ -1748,7 +1749,14 @@ static int find_nvmem_device(void) continue; } - fread(buf, sizeof(buf), 1, fp); + size = fread(buf, sizeof(buf), 1, fp); + if (size != 1) { + fprintf(stderr, + "read failed about %s\n", comp); + fclose(fp); + return -EIO; + } + if (!strcmp(buf, "u-boot,env")) { bytes = asprintf(&nvmem, "%s/%s/nvmem", path, dent->d_name); |