Commit 58e31916 authored by zwelch's avatar zwelch
Browse files

Eliminate duplicated code in the handle_mw_command memory write loop.

- wordsize will always be 1, 2, or 4 due to preceeding switch statement.
- move call to keep_alive after successful writes, not upon failures


git-svn-id: svn://svn.berlios.de/openocd/trunk@1953 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 335fee3f
......@@ -1958,27 +1958,11 @@ static int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char
}
for (i=0; i<count; i++)
{
int retval;
switch (wordsize)
{
case 4:
retval = target->type->write_memory(target, address + i*wordsize, 4, 1, value_buf);
break;
case 2:
retval = target->type->write_memory(target, address + i*wordsize, 2, 1, value_buf);
break;
case 1:
retval = target->type->write_memory(target, address + i*wordsize, 1, 1, value_buf);
break;
default:
return ERROR_OK;
}
keep_alive();
if (retval!=ERROR_OK)
{
int retval = target->type->write_memory(target,
address + i * wordsize, wordsize, 1, value_buf);
if (ERROR_OK != retval)
return retval;
}
keep_alive();
}
return ERROR_OK;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment