stm32l4x: cosmetic simplification of get_stm32l4_info

Change-Id: I2542f946f64388d908b1502f869643080fce9f9e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5536
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Tarek BOCHKATI 2020-03-22 19:36:12 +01:00 committed by Tomas Vanek
parent 3d736e0488
commit 726b0c5928
1 changed files with 8 additions and 10 deletions

View File

@ -1218,19 +1218,17 @@ static int get_stm32l4_info(struct flash_bank *bank, char *buf, int buf_size)
for (unsigned int i = 0; i < part_info->num_revs; i++) {
if (rev_id == part_info->revs[i].rev) {
rev_str = part_info->revs[i].str;
if (rev_str != NULL) {
snprintf(buf, buf_size, "%s - Rev: %s%s",
part_info->device_str, rev_str, stm32l4_info->probed ?
(stm32l4_info->dual_bank_mode ? " dual-bank" : " single-bank") : "");
return ERROR_OK;
}
break;
}
}
snprintf(buf, buf_size, "%s - Rev: unknown (0x%04x)%s",
part_info->device_str, rev_id, stm32l4_info->probed ?
(stm32l4_info->dual_bank_mode ? " dual-bank" : " single-bank") : "");
int buf_len = snprintf(buf, buf_size, "%s - Rev %s : 0x%04x",
part_info->device_str, rev_str ? rev_str : "'unknown'", rev_id);
if (stm32l4_info->probed)
snprintf(buf + buf_len, buf_size - buf_len, " - %s-bank",
stm32l4_info->dual_bank_mode ? "Flash dual" : "Flash single");
return ERROR_OK;
} else {
snprintf(buf, buf_size, "Cannot identify target as an %s device", device_families);