/* 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) {