diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-09-10 10:20:06 +0200 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-09-11 10:37:32 +0200 |
commit | ef92da3315b13ab8ee3b509f2b05c15194140b92 (patch) | |
tree | b9d05e503541e5347faae516b86faa893814147c /src/flash | |
parent | e1c6f6783d68f0dcc766b3e6317348e3838a3856 (diff) | |
download | openocd_libswd-ef92da3315b13ab8ee3b509f2b05c15194140b92.tar.gz openocd_libswd-ef92da3315b13ab8ee3b509f2b05c15194140b92.tar.bz2 openocd_libswd-ef92da3315b13ab8ee3b509f2b05c15194140b92.tar.xz openocd_libswd-ef92da3315b13ab8ee3b509f2b05c15194140b92.zip |
cfi: tighten up type usage a bit
sizeof() is a bit less scary than seing assumption
about size of type, no bug as such.
Use NULL instead of 0 for pointers. More obvious that
it is a pointer from code inspection.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/nor/cfi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 9813d83b..5b5b4da9 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -805,7 +805,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) cfi_info = malloc(sizeof(struct cfi_flash_bank)); cfi_info->probed = 0; - cfi_info->erase_region_info = 0; + cfi_info->erase_region_info = NULL; cfi_info->pri_ext = NULL; bank->driver_priv = cfi_info; @@ -2494,7 +2494,8 @@ static int cfi_probe(struct flash_bank *bank) if (cfi_info->num_erase_regions) { - cfi_info->erase_region_info = malloc(4 * cfi_info->num_erase_regions); + cfi_info->erase_region_info = malloc(sizeof(*cfi_info->erase_region_info) + * cfi_info->num_erase_regions); for (i = 0; i < cfi_info->num_erase_regions; i++) { retval = cfi_query_u32(bank, 0, 0x2d + (4 * i), &cfi_info->erase_region_info[i]); |