From a895b3b4f830d24d714cb9f11fc8cef92b84df72 Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Thu, 26 May 2022 13:51:18 +0200 Subject: [PATCH] flash/nor/fespi: check target type Change-Id: I09d3ed20966b37ec63c09c2ffb0e0403986cb1e5 Signed-off-by: Tomas Vanek Reviewed-on: https://review.openocd.org/c/openocd/+/7001 Tested-by: jenkins Reviewed-by: Antonio Borneo Reviewed-by: Tim Newsome --- src/flash/nor/fespi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/flash/nor/fespi.c b/src/flash/nor/fespi.c index d33c5260c..c61b708b1 100644 --- a/src/flash/nor/fespi.c +++ b/src/flash/nor/fespi.c @@ -512,6 +512,12 @@ static int fespi_write(struct flash_bank *bank, const uint8_t *buffer, } } + struct riscv_info *riscv = riscv_info(target); + if (!is_riscv(riscv)) { + LOG_ERROR("Unexpected target type"); + return ERROR_FAIL; + } + unsigned int xlen = riscv_xlen(target); struct working_area *algorithm_wa = NULL; struct working_area *data_wa = NULL;