]> git.sur5r.net Git - u-boot/commitdiff
cfi_flash: Use u8 pointers instead of void pointers
authorMario Six <mario.six@gdsys.cc>
Fri, 26 Jan 2018 13:43:49 +0000 (14:43 +0100)
committerStefan Roese <sr@denx.de>
Mon, 29 Jan 2018 06:48:58 +0000 (07:48 +0100)
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>
drivers/mtd/cfi_flash.c

index 48086ded5c99e6929fc96d871b62a14ebbfcba61..fced9847efc3f09eb0f2516f680e665368f42f72 100644 (file)
@@ -491,7 +491,7 @@ static int flash_isset(flash_info_t *info, flash_sect_t sect,
 static int flash_toggle(flash_info_t *info, flash_sect_t sect,
                         uint offset, uchar cmd)
 {
-       void *addr;
+       u8 *addr;
        cfiword_t cword;
        int retval;
 
@@ -872,9 +872,9 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
        flash_sect_t sector;
        int cnt;
        int retcode;
-       void *src = cp;
-       void *dst = (void *)dest;
-       void *dst2 = dst;
+       u8 *src = cp;
+       u8 *dst = (u8 *)dest;
+       u8 *dst2 = dst;
        int flag = 1;
        uint offset = 0;
        unsigned int shift;