Commit 5312838dd5b3959907d6c4f0ec3e04954210fafc
Committed by
Stefan Roese
1 parent
d3525b6bb0
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
cfi_flash: Use u8 pointers instead of void pointers
According to the C standard, pointer arithmetic for pointers of type void is undefined behavior (the assumption that they're 8-bit wide is a GCC-specific assumption). In the interest of keeping the code standards-compliant, and also better communicate intent, switch all void* variables where pointer arithmetic is used to u8* variables. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
drivers/mtd/cfi_flash.c
... | ... | @@ -491,7 +491,7 @@ |
491 | 491 | static int flash_toggle(flash_info_t *info, flash_sect_t sect, |
492 | 492 | uint offset, uchar cmd) |
493 | 493 | { |
494 | - void *addr; | |
494 | + u8 *addr; | |
495 | 495 | cfiword_t cword; |
496 | 496 | int retval; |
497 | 497 | |
... | ... | @@ -872,9 +872,9 @@ |
872 | 872 | flash_sect_t sector; |
873 | 873 | int cnt; |
874 | 874 | int retcode; |
875 | - void *src = cp; | |
876 | - void *dst = (void *)dest; | |
877 | - void *dst2 = dst; | |
875 | + u8 *src = cp; | |
876 | + u8 *dst = (u8 *)dest; | |
877 | + u8 *dst2 = dst; | |
878 | 878 | int flag = 1; |
879 | 879 | uint offset = 0; |
880 | 880 | unsigned int shift; |