summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-07 05:22:53 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-07 05:22:53 +0000
commit861f52ff16417bf3077a236b866d906636424d2c (patch)
tree9f7b6fcaf895c7bfa7f9321cc7fc3a138929214c
parent15ae1ac678b037f3eac7de7b31da818020005fdc (diff)
downloadopenocd_libswd-861f52ff16417bf3077a236b866d906636424d2c.tar.gz
openocd_libswd-861f52ff16417bf3077a236b866d906636424d2c.tar.bz2
openocd_libswd-861f52ff16417bf3077a236b866d906636424d2c.tar.xz
openocd_libswd-861f52ff16417bf3077a236b866d906636424d2c.zip
Factoring of jtag_examine_chain for maintainability:
- Reduce indent: invert logical test of expected_id count. git-svn-id: svn://svn.berlios.de/openocd/trunk@2082 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/jtag/jtag.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c
index 47d16fdf..292aa55a 100644
--- a/src/jtag/jtag.c
+++ b/src/jtag/jtag.c
@@ -1077,30 +1077,29 @@ static int jtag_examine_chain(void)
}
/* If none of the expected ids matched, log an error */
- if (ii == tap->expected_ids_cnt) {
- LOG_ERROR("JTAG tap: %s got: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
- tap->dotted_name,
- idcode,
- EXTRACT_MFG( tap->idcode ),
- EXTRACT_PART( tap->idcode ),
- EXTRACT_VER( tap->idcode ) );
- for (ii = 0; ii < tap->expected_ids_cnt; ii++) {
- LOG_ERROR("JTAG tap: %s expected %hhu of %hhu: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
- tap->dotted_name,
- ii + 1,
- tap->expected_ids_cnt,
- tap->expected_ids[ii],
- EXTRACT_MFG( tap->expected_ids[ii] ),
- EXTRACT_PART( tap->expected_ids[ii] ),
- EXTRACT_VER( tap->expected_ids[ii] ) );
- }
-
- return ERROR_JTAG_INIT_FAILED;
- } else {
+ if (ii != tap->expected_ids_cnt)
+ {
LOG_INFO("JTAG Tap/device matched");
+ tap = jtag_tap_next_enabled(tap);
+ continue;
}
-
- tap = jtag_tap_next_enabled(tap);
+ LOG_ERROR("JTAG tap: %s got: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
+ tap->dotted_name,
+ idcode,
+ EXTRACT_MFG( tap->idcode ),
+ EXTRACT_PART( tap->idcode ),
+ EXTRACT_VER( tap->idcode ) );
+ for (ii = 0; ii < tap->expected_ids_cnt; ii++) {
+ LOG_ERROR("JTAG tap: %s expected %hhu of %hhu: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
+ tap->dotted_name,
+ ii + 1,
+ tap->expected_ids_cnt,
+ tap->expected_ids[ii],
+ EXTRACT_MFG( tap->expected_ids[ii] ),
+ EXTRACT_PART( tap->expected_ids[ii] ),
+ EXTRACT_VER( tap->expected_ids[ii] ) );
+ }
+ return ERROR_JTAG_INIT_FAILED;
}
/* see if number of discovered devices matches configuration */