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>
while (!nvmem && (dent = readdir(dir))) {
FILE *fp;
+ size_t size;
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
continue;
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);