This is an automated email from Gerrit.

"Tomas Vanek <[email protected]>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/9181

-- gerrit

commit ab1584a3a2bbc37dc5b1d7859bd9b87468fe7f49
Author: Tomas Vanek <[email protected]>
Date:   Wed Oct 22 21:47:28 2025 +0200

    target: drop useless call target_set_examined()
    
    target_set_examined() or target_reset_examined() is called in both
    handle_target_examine() and target_examine_one() depending
    on the result returned from target->type->examine method.
    
    Drop target_set_examined() from target specific examine methods
    unless the following part of examine code is suspected to require
    the examined state.
    
    Update the comment describing target_set_examined() usage.
    
    Change-Id: I68c76176f4a34bf21c8f3a2a417bc7cdcaf72e6f
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/target/arm11.c b/src/target/arm11.c
index 81026c68c4..bc23fefe34 100644
--- a/src/target/arm11.c
+++ b/src/target/arm11.c
@@ -1220,8 +1220,6 @@ static int arm11_examine(struct target *target)
                CHECK_RETVAL(etm_setup(target));
        }
 
-       target_set_examined(target);
-
        return ERROR_OK;
 }
 
diff --git a/src/target/avr32_ap7k.c b/src/target/avr32_ap7k.c
index a2da146c95..543764ec5d 100644
--- a/src/target/avr32_ap7k.c
+++ b/src/target/avr32_ap7k.c
@@ -527,7 +527,6 @@ static int avr32_ap7k_examine(struct target *target)
        struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
 
        if (!target_was_examined(target)) {
-               target_set_examined(target);
                avr32_jtag_nexus_read(&ap7k->jtag, AVR32_OCDREG_DID, &devid);
                LOG_INFO("device id: %08" PRIx32, devid);
                avr32_ocd_setbits(&ap7k->jtag, AVR32_OCDREG_DC, OCDREG_DC_DBE);
diff --git a/src/target/mem_ap.c b/src/target/mem_ap.c
index c5618c9ccd..3e62e35e92 100644
--- a/src/target/mem_ap.c
+++ b/src/target/mem_ap.c
@@ -143,7 +143,6 @@ static int mem_ap_examine(struct target *target)
                                return ERROR_FAIL;
                        }
                }
-               target_set_examined(target);
                target->state = TARGET_UNKNOWN;
                target->debug_reason = DBG_REASON_UNDEFINED;
                return mem_ap_init(mem_ap->ap);
diff --git a/src/target/mips32.c b/src/target/mips32.c
index b8c61a5bfc..dae55bfd24 100644
--- a/src/target/mips32.c
+++ b/src/target/mips32.c
@@ -734,8 +734,6 @@ int mips32_examine(struct target *target)
        struct mips32_common *mips32 = target_to_mips32(target);
 
        if (!target_was_examined(target)) {
-               target_set_examined(target);
-
                /* we will configure later */
                mips32->bp_scanned = 0;
                mips32->num_inst_bpoints = 0;
diff --git a/src/target/mips64.c b/src/target/mips64.c
index 0a3ded0aa3..515f8a7f5d 100644
--- a/src/target/mips64.c
+++ b/src/target/mips64.c
@@ -479,8 +479,6 @@ int mips64_examine(struct target *target)
        mips64->num_inst_bpoints = 0;
        mips64->num_inst_bpoints_avail = 0;
 
-       target_set_examined(target);
-
        return ERROR_OK;
 }
 
diff --git a/src/target/stm8.c b/src/target/stm8.c
index 05989eeb95..c39d9bc5dc 100644
--- a/src/target/stm8.c
+++ b/src/target/stm8.c
@@ -1747,8 +1747,6 @@ static int stm8_examine(struct target *target)
                        }
                }
 
-               target_set_examined(target);
-
                return ERROR_OK;
        }
 
diff --git a/src/target/target.h b/src/target/target.h
index 882339ded3..35a85672b9 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -450,8 +450,10 @@ static inline bool target_active_polled(const struct 
target *target)
        return target->active_polled;
 }
 
-/** Sets the @c examined and @c active_polled flags for the given target. */
-/** Use in target->type->examine() after one-time setup is done. */
+/** Sets the @c examined and @c active_polled flags for the given target.
+ *  Not necessary to call it in target->type->examine() methods,
+ *  the target infarstructure calls it after successful return
+ *  from this method. */
 static inline void target_set_examined(struct target *target)
 {
        target->active_polled = true;

-- 

Reply via email to