Commit 0060517ae087eed94c64c175e5042b16e0a415fa

Authored by Wolfgang Denk
Committed by Tom Rini
1 parent adbba99606

cppcheck cleanup: fix nullPointer errors

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>

Showing 9 changed files with 17 additions and 2 deletions Side-by-side Diff

arch/arm/cpu/arm926ejs/mxs/mxs.c
... ... @@ -83,7 +83,9 @@
83 83 int i;
84 84  
85 85 for (i = 0; i < 8; i++) {
  86 + /* cppcheck-suppress nullPointer */
86 87 vt[i] = ldr_pc;
  88 + /* cppcheck-suppress nullPointer */
87 89 vt[i + 8] = start_addr + (4 * i);
88 90 }
89 91 }
arch/arm/cpu/arm926ejs/mxs/spl_boot.c
... ... @@ -118,6 +118,8 @@
118 118 * fine.
119 119 */
120 120 extern uint32_t _start;
  121 +
  122 + /* cppcheck-suppress nullPointer */
121 123 memcpy(0x0, &_start, 0x60);
122 124 }
123 125  
arch/arm/cpu/armv7/zynq/ddrc.c
... ... @@ -40,6 +40,7 @@
40 40 * first stage bootloader. To get ECC to work all memory has
41 41 * been initialized by writing any value.
42 42 */
  43 + /* cppcheck-suppress nullPointer */
43 44 memset((void *)0, 0, 1 * 1024 * 1024);
44 45 } else {
45 46 puts("ECC disabled ");
arch/blackfin/cpu/initcode.c
... ... @@ -955,6 +955,7 @@
955 955 uint32_t *hibernate_magic = 0;
956 956  
957 957 SSYNC();
  958 + /* cppcheck-suppress nullPointer */
958 959 if (hibernate_magic[0] == 0xDEADBEEF) {
959 960 serial_putc('c');
960 961 bfin_write_EVT15(hibernate_magic[1]);
arch/powerpc/cpu/mpc85xx/cpu_init_early.c
... ... @@ -161,9 +161,12 @@
161 161 setup_ifc_sram = (void *)SRAM_BASE_ADDR;
162 162 dst = (u32 *) SRAM_BASE_ADDR;
163 163 src = (u32 *) setup_ifc;
164   - for (i = 0; i < 1024; i++)
  164 + for (i = 0; i < 1024; i++) {
  165 + /* cppcheck-suppress nullPointer */
165 166 *dst++ = *src++;
  167 + }
166 168  
  169 + /* cppcheck-suppress nullPointer */
167 170 setup_ifc_sram();
168 171  
169 172 /* CLEANUP */
arch/sh/lib/zimageboot.c
... ... @@ -45,6 +45,7 @@
45 45 bootargs = getenv("bootargs");
46 46  
47 47 /* Clear zero page */
  48 + /* cppcheck-suppress nullPointer */
48 49 memset(param, 0, 0x1000);
49 50  
50 51 /* Set commandline */
board/esd/pci405/cmd_pci405.c
... ... @@ -23,7 +23,7 @@
23 23 */
24 24 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
25 25 {
26   - unsigned int *ptr = 0;
  26 + unsigned int *ptr;
27 27 int count = 0;
28 28 int count2 = 0;
29 29 int i;
30 30  
... ... @@ -35,12 +35,14 @@
35 35 * Mark sync address
36 36 */
37 37 ptr = 0;
  38 + /* cppcheck-suppress nullPointer */
38 39 *ptr = 0xffffffff;
39 40 puts("\nWaiting for image from pci host -");
40 41  
41 42 /*
42 43 * Wait for host to write the start address
43 44 */
  45 + /* cppcheck-suppress nullPointer */
44 46 while (*ptr == 0xffffffff) {
45 47 count++;
46 48 if (!(count % 100)) {
board/keymile/common/common.c
... ... @@ -360,6 +360,7 @@
360 360 testboot = (testpin != 0) && (s);
361 361 if (verbose) {
362 362 printf("testpin = %d\n", testpin);
  363 + /* cppcheck-suppress nullPointer */
363 364 printf("test_bank = %s\n", s ? s : "not set");
364 365 printf("boot test app : %s\n", (testboot) ? "yes" : "no");
365 366 }
board/scb9328/flash.c
... ... @@ -72,8 +72,10 @@
72 72  
73 73 FLASH_BUS *addr = (FLASH_BUS *) 0;
74 74  
  75 + /* cppcheck-suppress nullPointer */
75 76 *addr = FLASH_CMD (CFI_INTEL_CMD_READ_STATUS_REGISTER);
76 77  
  78 + /* cppcheck-suppress nullPointer */
77 79 return *addr;
78 80 }
79 81