arm_dpm: avoid duplicating the register cache

This bug was already attempted to fix in an earlier patch but
merging the "defer-examine" feature caused a regression, which this patch
tries to fix again.

Change-Id: Ie1ad1516f0d7f130d44e003d6c29dcc1a02a82ca
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/3951
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
gitignore-build
Matthias Welwarsky 2017-01-19 16:57:04 +01:00 committed by Paul Fertser
parent 1c4aa20b21
commit 59820c18d0
1 changed files with 7 additions and 4 deletions

View File

@ -972,11 +972,14 @@ int arm_dpm_setup(struct arm_dpm *dpm)
arm->read_core_reg = arm_dpm_read_core_reg; arm->read_core_reg = arm_dpm_read_core_reg;
arm->write_core_reg = arm_dpm_write_core_reg; arm->write_core_reg = arm_dpm_write_core_reg;
/* avoid duplicating the register cache */
if (arm->core_cache == NULL) {
cache = arm_build_reg_cache(target, arm); cache = arm_build_reg_cache(target, arm);
if (!cache) if (!cache)
return ERROR_FAIL; return ERROR_FAIL;
*register_get_last_cache_p(&target->reg_cache) = cache; *register_get_last_cache_p(&target->reg_cache) = cache;
}
/* coprocessor access setup */ /* coprocessor access setup */
arm->mrc = dpm_mrc; arm->mrc = dpm_mrc;