Fix some niggles found by clang's static analysis.

Change-Id: Id476227e1bd02e067f0cc4da9bc7ffb3d9d30535
This commit is contained in:
Tim Newsome
2018-01-22 11:44:36 -08:00
parent cb543e804d
commit 553a63808c
4 changed files with 31 additions and 14 deletions
+2 -1
View File
@@ -795,7 +795,6 @@ static int steps_execute(struct algorithm_steps *as,
struct target *target = bank->target;
struct fespi_flash_bank *fespi_info = bank->driver_priv;
uint32_t ctrl_base = fespi_info->ctrl_base;
uint8_t *data_buf = malloc(data_wa->size);
int xlen = riscv_xlen(target);
struct reg_param reg_params[2];
@@ -805,9 +804,11 @@ static int steps_execute(struct algorithm_steps *as,
buf_set_u64(reg_params[1].value, 0, xlen, data_wa->address);
while (!as_empty(as)) {
keep_alive();
uint8_t *data_buf = malloc(data_wa->size);
unsigned bytes = as_compile(as, data_buf, data_wa->size);
int retval = target_write_buffer(target, data_wa->address, bytes,
data_buf);
free(data_buf);
if (retval != ERROR_OK) {
LOG_ERROR("Failed to write data to 0x%" TARGET_PRIxADDR ": %d",
data_wa->address, retval);