X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Ffaux.c;h=8198ef52143efbfcd81de5440c948b6116e4922e;hb=89bf96ffe6ac66c80407af8383b9d5adc0dc35f4;hp=8e51b8e55ca261f7431871fc5956692ac144318c;hpb=08d4411b59dd8bd0e7d8009003b71d23acbf6eee;p=openocd.git diff --git a/src/flash/nor/faux.c b/src/flash/nor/faux.c index 8e51b8e55c..8198ef5214 100644 --- a/src/flash/nor/faux.c +++ b/src/flash/nor/faux.c @@ -50,7 +50,7 @@ FLASH_BANK_COMMAND_HANDLER(faux_flash_bank_command) return ERROR_FAIL; } info->memory = malloc(bank->size); - if (info == NULL) { + if (info->memory == NULL) { free(info); LOG_ERROR("no memory for flash bank info"); return ERROR_FAIL; @@ -93,7 +93,7 @@ static int faux_protect(struct flash_bank *bank, int set, int first, int last) return ERROR_OK; } -static int faux_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int faux_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { struct faux_flash_bank *info = bank->driver_priv; memcpy(info->memory + offset, buffer, count);