if ((retval = flash_erase_address_range(target, address, length)) == ERROR_OK)
{
- duration_stop_measure(&duration, &duration_text);
+ if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+ {
+ free(duration_text);
+ return retval;
+ }
command_print(cmd_ctx, "erased address 0x%8.8x length %i in %s", address, length, duration_text);
free(duration_text);
}
if ((retval = flash_driver_erase(p, first, last)) == ERROR_OK)
{
- duration_stop_measure(&duration, &duration_text);
+ if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+ {
+ free(duration_text);
+ return retval;
+ }
command_print(cmd_ctx, "erased sectors %i through %i on flash bank %i in %s", first, last, strtoul(args[0], 0, 0), duration_text);
free(duration_text);
duration_t duration;
char *duration_text;
- int retval;
+ int retval, retvaltemp;
if (argc < 1)
{
return retval;
}
- duration_stop_measure(&duration, &duration_text);
+ if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+ {
+ free(duration_text);
+ image_close(&image);
+ return retvaltemp;
+ }
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "wrote %u byte from file %s in %s (%f kb/s)",
int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- int err = ERROR_OK;
+ int err = ERROR_OK, retval;
u32 address;
u32 pattern;
u32 count;
}
}
- duration_stop_measure(&duration, &duration_text);
+ if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+ {
+ free(duration_text);
+ return retval;
+ }
+
if(err == ERROR_OK)
{
duration_t duration;
char *duration_text;
- int retval;
+ int retval, retvaltemp;
flash_bank_t *p;
if (argc != 3)
free(buffer);
buffer = NULL;
- duration_stop_measure(&duration, &duration_text);
+ if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+ {
+ free(duration_text);
+ fileio_close(&fileio);
+ return retvaltemp;
+ }
if (retval!=ERROR_OK)
{
command_print(cmd_ctx, "wrote %"PRIi64" byte from file %s to flash bank %i at offset 0x%8.8x in %s (%f kb/s)",