]> git.sur5r.net Git - openocd/blobdiff - src/target/cortex_m.c
adi_v5: enforce check on AP number value
[openocd] / src / target / cortex_m.c
index ca3dbec78dbc61b924d54230c66468b8db3f00c5..d1f7f3eea8e48560feaa49b81d58b3dd9980fe0f 100644 (file)
@@ -1986,7 +1986,7 @@ int cortex_m_examine(struct target *target)
        /* stlink shares the examine handler but does not support
         * all its calls */
        if (!armv7m->stlink) {
-               if (cortex_m->apsel < 0) {
+               if (cortex_m->apsel == DP_APSEL_INVALID) {
                        /* Search for the MEM-AP */
                        retval = dap_find_ap(swjdp, AP_TYPE_AHB_AP, &armv7m->debug_ap);
                        if (retval != ERROR_OK) {