fix lpc2000 flash programming fail.

some members of lpc2000_info structure sometimes used uninitialized
 (cmd51_can_64b for all LPC except LPC800 as example).
  Init allocated lpc2000_info structure with zeros to avoid this and similar bugs in the future.
  Note: maybe discarding all cmd51_can_XXXb fields and using cmd51_dst_boundary instead will be a better solution.

Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Change-Id: Idf116a5b0bf4ea1c39ea0ce308ec2c13bfbd4d8c
Reviewed-on: http://openocd.zylin.com/1676
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
This commit is contained in:
Sergey A. Borshch 2013-10-03 16:05:15 +03:00 committed by Spencer Oliver
parent bc7837007c
commit 9b3e7fb888
1 changed files with 2 additions and 1 deletions

View File

@ -559,7 +559,8 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command)
if (CMD_ARGC < 8) if (CMD_ARGC < 8)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
struct lpc2000_flash_bank *lpc2000_info = malloc(sizeof(struct lpc2000_flash_bank)); struct lpc2000_flash_bank *lpc2000_info = calloc(1, sizeof(*lpc2000_info));
bank->driver_priv = lpc2000_info; bank->driver_priv = lpc2000_info;
if (strcmp(CMD_ARGV[6], "lpc2000_v1") == 0) { if (strcmp(CMD_ARGV[6], "lpc2000_v1") == 0) {