]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
cppcheck cleanup: fix nullPointer errors
authorWolfgang Denk <wd@denx.de>
Thu, 6 Nov 2014 13:02:57 +0000 (14:02 +0100)
committerTom Rini <trini@ti.com>
Fri, 7 Nov 2014 21:27:07 +0000 (16:27 -0500)
There are a number of places where U-Boot intentionally and legally
accesses physical address 0x0000, for example when installing
exception vectors on systems where these are located in low memory.

Add "cppcheck-suppress nullPointer" comments to silence cppcheck
where this is intentional and legal.

Signed-off-by: Wolfgang Denk <wd@denx.de>
arch/arm/cpu/arm926ejs/mxs/mxs.c
arch/arm/cpu/arm926ejs/mxs/spl_boot.c
arch/arm/cpu/armv7/zynq/ddrc.c
arch/blackfin/cpu/initcode.c
arch/powerpc/cpu/mpc85xx/cpu_init_early.c
arch/sh/lib/zimageboot.c
board/esd/pci405/cmd_pci405.c
board/keymile/common/common.c
board/scb9328/flash.c

index 365542fe0bb29e1a7c2cc4ff4d35c83adb41d37b..ef130aea426975babb926a48d0da0e863ec65638 100644 (file)
@@ -83,7 +83,9 @@ void mx28_fixup_vt(uint32_t start_addr)
        int i;
 
        for (i = 0; i < 8; i++) {
+               /* cppcheck-suppress nullPointer */
                vt[i] = ldr_pc;
+               /* cppcheck-suppress nullPointer */
                vt[i + 8] = start_addr + (4 * i);
        }
 }
index d3e136991ad2035ad187b6ac22095711561bfaa2..d29b9aaf3da576889bfb02620e8e7aeb106b8db7 100644 (file)
@@ -118,6 +118,8 @@ static void mxs_spl_fixup_vectors(void)
         * fine.
         */
        extern uint32_t _start;
+
+       /* cppcheck-suppress nullPointer */
        memcpy(0x0, &_start, 0x60);
 }
 
index 1ea086d520795880cfbc6e63741831be232c9f9a..d74f8dbbc45dfb9f6440ea38fa44552404f436ef 100644 (file)
@@ -40,6 +40,7 @@ void zynq_ddrc_init(void)
                 * first stage bootloader. To get ECC to work all memory has
                 * been initialized by writing any value.
                 */
+               /* cppcheck-suppress nullPointer */
                memset((void *)0, 0, 1 * 1024 * 1024);
        } else {
                puts("ECC disabled ");
index 2e640afc453a853b32b6f064a5a4688bbba6a1ff..fde54eaa3e55cefb8858214fcb1c3228fea77c6e 100644 (file)
@@ -955,6 +955,7 @@ check_hibernation(ADI_BOOT_DATA *bs, u16 vr_ctl, bool put_into_srfs)
                uint32_t *hibernate_magic = 0;
 
                SSYNC();
+               /* cppcheck-suppress nullPointer */
                if (hibernate_magic[0] == 0xDEADBEEF) {
                        serial_putc('c');
                        bfin_write_EVT15(hibernate_magic[1]);
index 47b712d56b5595a89d797cb9b868506606ede539..072387a87ef638313dca953d51453911d0ea48e2 100644 (file)
@@ -161,9 +161,12 @@ void cpu_init_early_f(void *fdt)
        setup_ifc_sram = (void *)SRAM_BASE_ADDR;
        dst = (u32 *) SRAM_BASE_ADDR;
        src = (u32 *) setup_ifc;
-       for (i = 0; i < 1024; i++)
+       for (i = 0; i < 1024; i++) {
+               /* cppcheck-suppress nullPointer */
                *dst++ = *src++;
+       }
 
+       /* cppcheck-suppress nullPointer */
        setup_ifc_sram();
 
        /* CLEANUP */
index 86d39983c8f20e6c88ff86b422ba7266b94adc94..3fea5f5b532108c124123ba32f996118991b5d51 100644 (file)
@@ -45,6 +45,7 @@ int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        bootargs = getenv("bootargs");
 
        /* Clear zero page */
+       /* cppcheck-suppress nullPointer */
        memset(param, 0, 0x1000);
 
        /* Set commandline */
index 55c20d02d3126f6b3cd4131133fc185c256d8f4a..29c688a787a3419bc0280ad38867f791c70c9dfe 100644 (file)
@@ -23,7 +23,7 @@
  */
 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       unsigned int *ptr = 0;
+       unsigned int *ptr;
        int count = 0;
        int count2 = 0;
        int i;
@@ -35,12 +35,14 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * Mark sync address
         */
        ptr = 0;
+       /* cppcheck-suppress nullPointer */
        *ptr = 0xffffffff;
        puts("\nWaiting for image from pci host -");
 
        /*
         * Wait for host to write the start address
         */
+       /* cppcheck-suppress nullPointer */
        while (*ptr == 0xffffffff) {
                count++;
                if (!(count % 100)) {
index 2ddb3da38f35f7245551bd66ebbffabd71f59420..b9aff1a84dcb4bf0c7f82184c7f948d5269af70e 100644 (file)
@@ -360,6 +360,7 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
        testboot = (testpin != 0) && (s);
        if (verbose) {
                printf("testpin   = %d\n", testpin);
+               /* cppcheck-suppress nullPointer */
                printf("test_bank = %s\n", s ? s : "not set");
                printf("boot test app : %s\n", (testboot) ? "yes" : "no");
        }
index e3a582f3dcf9cc0d38c249ef78314f14ecaaa469..73bfa00eed63ac993ede9bb9fc040a4424598223 100644 (file)
@@ -72,8 +72,10 @@ static FLASH_BUS_RET flash_status_reg (void)
 
        FLASH_BUS *addr = (FLASH_BUS *) 0;
 
+       /* cppcheck-suppress nullPointer */
        *addr = FLASH_CMD (CFI_INTEL_CMD_READ_STATUS_REGISTER);
 
+       /* cppcheck-suppress nullPointer */
        return *addr;
 }