diff options
| author | Joel Stanley <joel@jms.id.au> | 2018-10-24 09:21:28 +1030 |
|---|---|---|
| committer | Alistair Popple <alistair@popple.id.au> | 2018-10-26 14:36:45 +1100 |
| commit | b72248d700903e5c2e87f2ff21101508dcef8677 (patch) | |
| tree | d317836be4f7932939b4b622e1ed39bae5192dde /src | |
| parent | 59ebe397a34570daca3aa296f8cedc7bd3d940de (diff) | |
| download | pdbg-b72248d700903e5c2e87f2ff21101508dcef8677.tar.gz pdbg-b72248d700903e5c2e87f2ff21101508dcef8677.zip | |
Fix build failure in target detection
CI is failing to build:
src/options_arm.c:65:3: error: ignoring return value of 'fscanf',
declared with attribute warn_unused_result [-Werror=unused-result]
fscanf(cfam_id_file, "0x%" PRIx32, &cfam_id);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If we don't get the expected value in fscanf, display an error. The
code already will do the correct thing and fall through to the unknown
device case.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'src')
| -rw-r--r-- | src/options_arm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/options_arm.c b/src/options_arm.c index 88cf9c9..0dbc731 100644 --- a/src/options_arm.c +++ b/src/options_arm.c @@ -16,6 +16,7 @@ #include <stdio.h> #include <string.h> #include <unistd.h> +#include <errno.h> #include "main.h" @@ -61,8 +62,11 @@ static const char *default_kernel_target(void) cfam_id_file = fopen(FSI_CFAM_ID, "r"); if (cfam_id_file) { uint32_t cfam_id = 0; + int rc; - fscanf(cfam_id_file, "0x%" PRIx32, &cfam_id); + rc = fscanf(cfam_id_file, "0x%" PRIx32, &cfam_id); + if (rc != 1) + pdbg_log(PDBG_ERROR, "%s", strerror(errno)); fclose(cfam_id_file); switch((cfam_id >> 4) & 0xff) { |

