Message ID | 20181023225128.14964-1-joel@jms.id.au |
---|---|
State | Accepted |
Headers | show |
Series | Fix build failure in target detection | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | master/apply_patch Successfully applied |
snowpatch_ozlabs/build-multiarch | success | Test build-multiarch on branch master |
diff --git a/src/options_arm.c b/src/options_arm.c index 88cf9c92f491..0dbc7315f52d 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) {
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> --- Error is at: https://openpower.xyz/job/openpower/job/pdbg-master/7/console src/options_arm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)