From 14dafdbf92a6f6e64feea6796e1d9b399e26196f Mon Sep 17 00:00:00 2001 From: dragonmux Date: Wed, 27 Jul 2022 11:31:48 +0100 Subject: [PATCH] jtag_scan: Finished cleaning up in jtag_scan() --- src/target/jtag_scan.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/target/jtag_scan.c b/src/target/jtag_scan.c index 3412f7d..b5b6a57 100644 --- a/src/target/jtag_scan.c +++ b/src/target/jtag_scan.c @@ -215,21 +215,20 @@ uint32_t jtag_scan(const uint8_t *irlens) DEBUG_INFO("\n"); } - size_t i; - uint32_t j; /* Check for known devices and handle accordingly */ - for(i = 0; i < jtag_dev_count; i++) - for(j = 0; dev_descr[j].idcode; j++) - if((jtag_devs[i].jd_idcode & dev_descr[j].idmask) == - dev_descr[j].idcode) { - jtag_devs[i].current_ir = -1; + for (size_t device = 0; device < jtag_dev_count; device++) { + for (size_t descr = 0; dev_descr[descr].idcode; descr++) { + if ((jtag_devs[device].jd_idcode & dev_descr[descr].idmask) == dev_descr[descr].idcode) { + jtag_devs[device].current_ir = -1; /* Save description in table */ - jtag_devs[i].jd_descr = dev_descr[j].descr; + jtag_devs[device].jd_descr = dev_descr[descr].descr; /* Call handler to initialise/probe device further */ - if(dev_descr[j].handler) - dev_descr[j].handler(i); + if (dev_descr[descr].handler) + dev_descr[descr].handler(device); break; } + } + } return jtag_dev_count; }