From 2256d5d3dc98ea19f5e0fee9821a413c6a375618 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Mon, 14 May 2012 12:50:04 +0000 Subject: [PATCH] Fix usage of possibly uninitialized 'result'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Can't tell how gcc/clang fail to detect this… --- examples/pn53x-diagnose.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/pn53x-diagnose.c b/examples/pn53x-diagnose.c index 6743eaa..9cbe906 100644 --- a/examples/pn53x-diagnose.c +++ b/examples/pn53x-diagnose.c @@ -97,27 +97,27 @@ main (int argc, const char *argv[]) // Result of Diagnose ping for RC-S360 doesn't contain status byte so we've to handle both cases result = (memcmp (pncmd_diagnose_communication_line_test + 1, abtRx, sizeof (pncmd_diagnose_communication_line_test) - 1) == 0) || (memcmp (pncmd_diagnose_communication_line_test + 2, abtRx, sizeof (pncmd_diagnose_communication_line_test) - 2) == 0); + printf (" Communication line test: %s\n", result ? "OK" : "Failed"); } else { - nfc_perror (pnd, "pn53x_transceive"); + nfc_perror (pnd, "pn53x_transceive: cannot diagnose communication line"); } - printf (" Communication line test: %s\n", result ? "OK" : "Failed"); res = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, szRx, 0); if (res > 0) { szRx = (size_t) res; result = ((szRx == 1) && (abtRx[0] == 0x00)); + printf (" ROM test: %s\n", result ? "OK" : "Failed"); } else { - nfc_perror (pnd, "pn53x_transceive"); + nfc_perror (pnd, "pn53x_transceive: cannot diagnose ROM"); } - printf (" ROM test: %s\n", result ? "OK" : "Failed"); res = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, szRx, 0); if (res > 0) { szRx = (size_t) res; result = ((szRx == 1) && (abtRx[0] == 0x00)); + printf (" RAM test: %s\n", result ? "OK" : "Failed"); } else { - nfc_perror (pnd, "pn53x_transceive"); + nfc_perror (pnd, "pn53x_transceive: cannot diagnose RAM"); } - printf (" RAM test: %s\n", result ? "OK" : "Failed"); } }