From patchwork Thu Nov 6 13:02:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Denk X-Patchwork-Id: 407445 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 27D1714008C for ; Fri, 7 Nov 2014 00:03:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 079554BFD7; Thu, 6 Nov 2014 14:03:29 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id znetW21OzOJL; Thu, 6 Nov 2014 14:03:28 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7E8584BFCD; Thu, 6 Nov 2014 14:03:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 508A74BFCA for ; Thu, 6 Nov 2014 14:03:24 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q+1-eU8qBDym for ; Thu, 6 Nov 2014 14:03:24 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id 19AC44BFC7 for ; Thu, 6 Nov 2014 14:03:20 +0100 (CET) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3jYPzr20y0z3hjlc; Thu, 6 Nov 2014 14:03:20 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3jYPzr1XwqzvSg1; Thu, 6 Nov 2014 14:03:20 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.184]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id 0YwfSL8jRDIY; Thu, 6 Nov 2014 14:03:16 +0100 (CET) X-Auth-Info: RVwxyMmbXh83InWeTgIVaJtnnmNBCpfVkinPrH/P6Ws= Received: from diddl.denx.de (host-80-81-18-216.customer.m-online.net [80.81.18.216]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA; Thu, 6 Nov 2014 14:03:13 +0100 (CET) Received: from gemini.denx.de (gemini.denx.de [10.0.0.2]) by diddl.denx.de (Postfix) with ESMTP id 642051AAC32; Thu, 6 Nov 2014 14:03:10 +0100 (CET) Received: by gemini.denx.de (Postfix, from userid 500) id 31F81382347; Thu, 6 Nov 2014 14:03:10 +0100 (MET) From: Wolfgang Denk To: u-boot@lists.denx.de Date: Thu, 6 Nov 2014 14:02:57 +0100 Message-Id: <1415278985-8482-2-git-send-email-wd@denx.de> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1415278985-8482-1-git-send-email-wd@denx.de> References: <1415278985-8482-1-git-send-email-wd@denx.de> Cc: Roger Meier Subject: [U-Boot] [PATCH 1/9] cppcheck cleanup: fix nullPointer errors X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- arch/arm/cpu/arm926ejs/mxs/mxs.c | 2 ++ arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 ++ arch/arm/cpu/armv7/zynq/ddrc.c | 1 + arch/blackfin/cpu/initcode.c | 1 + arch/powerpc/cpu/mpc85xx/cpu_init_early.c | 5 ++++- arch/sh/lib/zimageboot.c | 1 + board/esd/pci405/cmd_pci405.c | 4 +++- board/keymile/common/common.c | 1 + board/scb9328/flash.c | 2 ++ 9 files changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c index 365542f..ef130ae 100644 --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c @@ -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); } } diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c index d3e1369..d29b9aa 100644 --- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c @@ -118,6 +118,8 @@ static void mxs_spl_fixup_vectors(void) * fine. */ extern uint32_t _start; + + /* cppcheck-suppress nullPointer */ memcpy(0x0, &_start, 0x60); } diff --git a/arch/arm/cpu/armv7/zynq/ddrc.c b/arch/arm/cpu/armv7/zynq/ddrc.c index 1ea086d..d74f8db 100644 --- a/arch/arm/cpu/armv7/zynq/ddrc.c +++ b/arch/arm/cpu/armv7/zynq/ddrc.c @@ -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 "); diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c index 2e640af..fde54ea 100644 --- a/arch/blackfin/cpu/initcode.c +++ b/arch/blackfin/cpu/initcode.c @@ -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]); diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init_early.c b/arch/powerpc/cpu/mpc85xx/cpu_init_early.c index 47b712d..072387a 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init_early.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init_early.c @@ -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 */ diff --git a/arch/sh/lib/zimageboot.c b/arch/sh/lib/zimageboot.c index 86d3998..3fea5f5 100644 --- a/arch/sh/lib/zimageboot.c +++ b/arch/sh/lib/zimageboot.c @@ -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 */ diff --git a/board/esd/pci405/cmd_pci405.c b/board/esd/pci405/cmd_pci405.c index 55c20d0..29c688a 100644 --- a/board/esd/pci405/cmd_pci405.c +++ b/board/esd/pci405/cmd_pci405.c @@ -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)) { diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 2ddb3da..b9aff1a 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -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"); } diff --git a/board/scb9328/flash.c b/board/scb9328/flash.c index e3a582f..73bfa00 100644 --- a/board/scb9328/flash.c +++ b/board/scb9328/flash.c @@ -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; }