From patchwork Mon Dec 4 03:37:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 120489 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3948156qgn; Sun, 3 Dec 2017 19:40:32 -0800 (PST) X-Google-Smtp-Source: AGs4zMbSL1JIAky8LdZsYZmHuqHGOzUriKLx3eCT7szGR+USX8KGCM31XeANO0Up/LEOqb5LyjEd X-Received: by 10.80.224.198 with SMTP id j6mr28671987edl.0.1512358832614; Sun, 03 Dec 2017 19:40:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512358832; cv=none; d=google.com; s=arc-20160816; b=NyTI6oFWHHy/WDWsYcnYRbJenXj/IEa2Fb3zbBt5SPbJUUVpS520tjneGLWL8GmV+T TPYO1m0sw9cPlt6lkCszwEvM6WhM5Pn+scf6whQ0sdb41EOPqDICAvrTlLhgC0+3fOi5 kwhKXMCPI6M6C47ncGNVrnpzf4/X6zdozGgVt1gGmq/e1Ikd89YdWMzEtSwzTDBn3jJC FZoUUjKPN4OWRh/6fLFv2ZNY1vSyM2gsaD742UfcT/iAoOMb/sDk7yQcaZPYjQe25Fa9 jQxJRT0H7RmgUkD3niLh56cYfFCB6kbDThdRgDfQzijwVRBh4lMIVaKZVnDR7OdDF/Ku SWLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=8oDvbn28OGDbwhzXsAhiIG7WtcOSBu+RhEkkn8com8w=; b=uPOs3vqDeSGIk4iUpM/SKMTgGZEIw9hXjJ7u0+EbM3u493WCK2QeFuGjkuCeZBBo7S MSa2DKTZs+Rau/hHpTcR2OPnXLqPlLF1qIpedR2kaJ9r/ILkWjSub3fBqdyNeGq81Ca0 G+jUnRy972jmP64NLnq8Ha3gqUseuVu8MJ0DMbNfA2ZL787Xzda794q3bmO7jnxmKqVr HttBvcF6LKU663J6YVu/g50XoDQLZP1yV5ROvLaoTkgqYIRCkwys2gQeZyH4B65sm5Dm AND9u93gckU3g8v8k5LWb+toSC1Ax3WUCVP2NPhfi7Bj0oAzEyPHiTXpsGK6VLpramwl AsCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=yZJ6hnZG; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id x7si5812986edl.469.2017.12.03.19.40.31; Sun, 03 Dec 2017 19:40:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=yZJ6hnZG; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id C7186C2205A; Mon, 4 Dec 2017 03:39:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=KHOP_BIG_TO_CC, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 582E6C22043; Mon, 4 Dec 2017 03:39:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 80D3FC2203A; Mon, 4 Dec 2017 03:38:33 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 58F54C22035 for ; Mon, 4 Dec 2017 03:38:28 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id vB43bE4p022247; Mon, 4 Dec 2017 12:37:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com vB43bE4p022247 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1512358638; bh=yAzduoAEHQltKB7haeIh/Sy0+wDr5d2kDF7LN+qCvjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZJ6hnZGDkp79vjjtF8z8n5+HGZl5rT0MAhbI5RtvwRhNknEeqlfrn6FMMuOaUWU0 XgyHkazzYJJ3qrLRWs4cYxa+lTZ3GNbVDZqJ+28TR/ErLP973Vtm+bq5dZXgYL6huw F4VX3M5DzKI71UdCiC6S2M0kSWKR68Qxe0P6IQF0Ki2z0GBRLW01kKOvFNHHZfnVw7 TByiKKhRF7bxYTiI23HxvfzV3h768Rt+Zt6k6blU6TJtqMOah727D9sOsb+5+etUVL Jw1+ALa3EBvpr8h7ILUadOnER0fjrvVseGenIiPxMsfqw64Hb0uDMJkAqlVyR3vswD mTDA1+xINVWCw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 4 Dec 2017 12:37:00 +0900 Message-Id: <1512358624-6309-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> References: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> Cc: Marek Vasut , Tom Rini , Priyanka Jain , Alexander Graf , Xiaobo Xie , Peter Tyser , Thomas Weber , Oleksandr Zhadan and Michael Durrant , Chunhe Lan , Andes , Andy Fleming , Po Liu Subject: [U-Boot] [PATCH v2 1/5] Move CONFIG_PANIC_HANG to Kconfig X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Freescale (NXP) boards have lots of defconfig files per board. I used "imply PANIC_HANG" for them. Signed-off-by: Masahiro Yamada Reviewed-by: York Sun --- Changes in v2: - Re-run tools/moveconfig.py based on commit 02907004294d9 README | 10 --------- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 3 +++ arch/powerpc/cpu/mpc85xx/Kconfig | 37 +++++++++++++++++++++++++++++++ configs/TWR-P1025_defconfig | 1 + configs/UCP1020_SPIFLASH_defconfig | 1 + configs/UCP1020_defconfig | 1 + configs/adp-ae3xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 1 + configs/tricorder_defconfig | 1 + configs/tricorder_flash_defconfig | 1 + configs/uniphier_ld4_sld8_defconfig | 1 + configs/uniphier_v7_defconfig | 1 + configs/uniphier_v8_defconfig | 1 + configs/xpedite517x_defconfig | 1 + configs/xpedite520x_defconfig | 1 + configs/xpedite537x_defconfig | 1 + configs/xpedite550x_defconfig | 1 + include/configs/B4860QDS.h | 1 - include/configs/C29XPCIE.h | 1 - include/configs/MPC8536DS.h | 1 - include/configs/MPC8544DS.h | 1 - include/configs/MPC8572DS.h | 1 - include/configs/P1010RDB.h | 1 - include/configs/P1023RDB.h | 2 -- include/configs/P2041RDB.h | 1 - include/configs/T102xQDS.h | 1 - include/configs/T102xRDB.h | 1 - include/configs/T1040QDS.h | 1 - include/configs/T104xRDB.h | 1 - include/configs/T4240RDB.h | 1 - include/configs/UCP1020.h | 1 - include/configs/adp-ae3xx.h | 1 - include/configs/corenet_ds.h | 1 - include/configs/cyrus.h | 1 - include/configs/ls1012a_common.h | 1 - include/configs/ls1088a_common.h | 2 -- include/configs/ls2080a_common.h | 2 -- include/configs/p1_p2_rdb_pc.h | 1 - include/configs/p1_twr.h | 1 - include/configs/qemu-ppce500.h | 1 - include/configs/t4qds.h | 1 - include/configs/tricorder.h | 1 - include/configs/uniphier.h | 2 -- include/configs/xpedite517x.h | 1 - include/configs/xpedite520x.h | 1 - include/configs/xpedite537x.h | 1 - include/configs/xpedite550x.h | 1 - include/configs/xtfpga.h | 4 ---- lib/Kconfig | 10 +++++++++ 49 files changed, 64 insertions(+), 48 deletions(-) diff --git a/README b/README index 2df0e1f..a7d2bef 100644 --- a/README +++ b/README @@ -2168,16 +2168,6 @@ The following options need to be configured: currently only supports clearing the memory. - Error Recovery: - CONFIG_PANIC_HANG - - Define this variable to stop the system in case of a - fatal error, so that you have to reset it manually. - This is probably NOT a good idea for an embedded - system where you want the system to reboot - automatically as fast as possible, but it may be - useful during development since you can try to debug - the conditions that lead to the situation. - CONFIG_NET_RETRY_COUNT This variable defines the number of retries for diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 5daf79e..e866193 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -7,6 +7,7 @@ config ARCH_LS1012A select SYS_FSL_ERRATUM_A010315 select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F + imply PANIC_HANG config ARCH_LS1043A bool @@ -85,6 +86,7 @@ config ARCH_LS1088A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F imply SCSI + imply PANIC_HANG config ARCH_LS2080A bool @@ -123,6 +125,7 @@ config ARCH_LS2080A select SYS_FSL_ERRATUM_A009203 select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F + imply PANIC_HANG config FSL_LSCH2 bool diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig index 92187d3..91fcc43 100644 --- a/arch/powerpc/cpu/mpc85xx/Kconfig +++ b/arch/powerpc/cpu/mpc85xx/Kconfig @@ -29,6 +29,7 @@ config TARGET_B4420QDS select ARCH_B4420 select SUPPORT_SPL select PHYS_64BIT + imply PANIC_HANG config TARGET_B4860QDS bool "Support B4860QDS" @@ -36,6 +37,7 @@ config TARGET_B4860QDS select BOARD_LATE_INIT if CHAIN_OF_TRUST select SUPPORT_SPL select PHYS_64BIT + imply PANIC_HANG config TARGET_BSC9131RDB bool "Support BSC9131RDB" @@ -57,6 +59,7 @@ config TARGET_C29XPCIE select SUPPORT_SPL select SUPPORT_TPL select PHYS_64BIT + imply PANIC_HANG config TARGET_P3041DS bool "Support P3041DS" @@ -64,6 +67,7 @@ config TARGET_P3041DS select ARCH_P3041 select BOARD_LATE_INIT if CHAIN_OF_TRUST imply CMD_SATA + imply PANIC_HANG config TARGET_P4080DS bool "Support P4080DS" @@ -71,6 +75,7 @@ config TARGET_P4080DS select ARCH_P4080 select BOARD_LATE_INIT if CHAIN_OF_TRUST imply CMD_SATA + imply PANIC_HANG config TARGET_P5020DS bool "Support P5020DS" @@ -78,6 +83,7 @@ config TARGET_P5020DS select ARCH_P5020 select BOARD_LATE_INIT if CHAIN_OF_TRUST imply CMD_SATA + imply PANIC_HANG config TARGET_P5040DS bool "Support P5040DS" @@ -85,6 +91,7 @@ config TARGET_P5040DS select ARCH_P5040 select BOARD_LATE_INIT if CHAIN_OF_TRUST imply CMD_SATA + imply PANIC_HANG config TARGET_MPC8536DS bool "Support MPC8536DS" @@ -92,6 +99,7 @@ config TARGET_MPC8536DS # Use DDR3 controller with DDR2 DIMMs on this board select SYS_FSL_DDRC_GEN3 imply CMD_SATA + imply PANIC_HANG config TARGET_MPC8541CDS bool "Support MPC8541CDS" @@ -100,6 +108,7 @@ config TARGET_MPC8541CDS config TARGET_MPC8544DS bool "Support MPC8544DS" select ARCH_MPC8544 + imply PANIC_HANG config TARGET_MPC8548CDS bool "Support MPC8548CDS" @@ -123,6 +132,7 @@ config TARGET_MPC8572DS # Use DDR3 controller with DDR2 DIMMs on this board select SYS_FSL_DDRC_GEN3 imply SCSI + imply PANIC_HANG config TARGET_P1010RDB_PA bool "Support P1010RDB_PA" @@ -132,6 +142,7 @@ config TARGET_P1010RDB_PA select SUPPORT_TPL imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1010RDB_PB bool "Support P1010RDB_PB" @@ -141,6 +152,7 @@ config TARGET_P1010RDB_PB select SUPPORT_TPL imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1022DS bool "Support P1022DS" @@ -153,6 +165,7 @@ config TARGET_P1023RDB bool "Support P1023RDB" select ARCH_P1023 imply CMD_EEPROM + imply PANIC_HANG config TARGET_P1020MBG bool "Support P1020MBG-PC" @@ -161,6 +174,7 @@ config TARGET_P1020MBG select ARCH_P1020 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1020RDB_PC bool "Support P1020RDB-PC" @@ -169,6 +183,7 @@ config TARGET_P1020RDB_PC select ARCH_P1020 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1020RDB_PD bool "Support P1020RDB-PD" @@ -177,6 +192,7 @@ config TARGET_P1020RDB_PD select ARCH_P1020 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1020UTM bool "Support P1020UTM" @@ -185,6 +201,7 @@ config TARGET_P1020UTM select ARCH_P1020 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1021RDB bool "Support P1021RDB" @@ -193,6 +210,7 @@ config TARGET_P1021RDB select ARCH_P1021 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1024RDB bool "Support P1024RDB" @@ -201,6 +219,7 @@ config TARGET_P1024RDB select ARCH_P1024 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1025RDB bool "Support P1025RDB" @@ -209,6 +228,7 @@ config TARGET_P1025RDB select ARCH_P1025 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P2020RDB bool "Support P2020RDB-PC" @@ -217,6 +237,7 @@ config TARGET_P2020RDB select ARCH_P2020 imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_P1_TWR bool "Support p1_twr" @@ -228,6 +249,7 @@ config TARGET_P2041RDB select BOARD_LATE_INIT if CHAIN_OF_TRUST select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_QEMU_PPCE500 bool "Support qemu-ppce500" @@ -242,6 +264,7 @@ config TARGET_T1024QDS select PHYS_64BIT imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_T1023RDB bool "Support T1023RDB" @@ -250,6 +273,7 @@ config TARGET_T1023RDB select SUPPORT_SPL select PHYS_64BIT imply CMD_EEPROM + imply PANIC_HANG config TARGET_T1024RDB bool "Support T1024RDB" @@ -258,6 +282,7 @@ config TARGET_T1024RDB select SUPPORT_SPL select PHYS_64BIT imply CMD_EEPROM + imply PANIC_HANG config TARGET_T1040QDS bool "Support T1040QDS" @@ -266,6 +291,7 @@ config TARGET_T1040QDS select PHYS_64BIT imply CMD_EEPROM imply CMD_SATA + imply PANIC_HANG config TARGET_T1040RDB bool "Support T1040RDB" @@ -274,6 +300,7 @@ config TARGET_T1040RDB select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_T1040D4RDB bool "Support T1040D4RDB" @@ -282,6 +309,7 @@ config TARGET_T1040D4RDB select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_T1042RDB bool "Support T1042RDB" @@ -290,6 +318,7 @@ config TARGET_T1042RDB select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_T1042D4RDB bool "Support T1042D4RDB" @@ -298,6 +327,7 @@ config TARGET_T1042D4RDB select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_T1042RDB_PI bool "Support T1042RDB_PI" @@ -306,6 +336,7 @@ config TARGET_T1042RDB_PI select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_T2080QDS bool "Support T2080QDS" @@ -336,12 +367,14 @@ config TARGET_T4160QDS select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_T4160RDB bool "Support T4160RDB" select ARCH_T4160 select SUPPORT_SPL select PHYS_64BIT + imply PANIC_HANG config TARGET_T4240QDS bool "Support T4240QDS" @@ -350,6 +383,7 @@ config TARGET_T4240QDS select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_T4240RDB bool "Support T4240RDB" @@ -357,6 +391,7 @@ config TARGET_T4240RDB select SUPPORT_SPL select PHYS_64BIT imply CMD_SATA + imply PANIC_HANG config TARGET_CONTROLCENTERD bool "Support controlcenterd" @@ -392,11 +427,13 @@ config TARGET_CYRUS_P5020 bool "Support Varisys Cyrus P5020" select ARCH_P5020 select PHYS_64BIT + imply PANIC_HANG config TARGET_CYRUS_P5040 bool "Support Varisys Cyrus P5040" select ARCH_P5040 select PHYS_64BIT + imply PANIC_HANG endchoice diff --git a/configs/TWR-P1025_defconfig b/configs/TWR-P1025_defconfig index 5dda2bb..45923db 100644 --- a/configs/TWR-P1025_defconfig +++ b/configs/TWR-P1025_defconfig @@ -34,4 +34,5 @@ CONFIG_SYS_NS16550=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/UCP1020_SPIFLASH_defconfig b/configs/UCP1020_SPIFLASH_defconfig index c8f2262..3c3e9fc 100644 --- a/configs/UCP1020_SPIFLASH_defconfig +++ b/configs/UCP1020_SPIFLASH_defconfig @@ -43,4 +43,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_FS_CRAMFS=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/UCP1020_defconfig b/configs/UCP1020_defconfig index 0092e99..bd17e05 100644 --- a/configs/UCP1020_defconfig +++ b/configs/UCP1020_defconfig @@ -43,4 +43,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_FS_CRAMFS=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/adp-ae3xx_defconfig b/configs/adp-ae3xx_defconfig index 6005669..cdbf801 100644 --- a/configs/adp-ae3xx_defconfig +++ b/configs/adp-ae3xx_defconfig @@ -39,3 +39,4 @@ CONFIG_DM_SPI=y CONFIG_ATCSPI200_SPI=y CONFIG_TIMER=y CONFIG_ATCPIT100_TIMER=y +CONFIG_PANIC_HANG=y diff --git a/configs/qemu-ppce500_defconfig b/configs/qemu-ppce500_defconfig index f1db0d0..9d27755 100644 --- a/configs/qemu-ppce500_defconfig +++ b/configs/qemu-ppce500_defconfig @@ -24,4 +24,5 @@ CONFIG_DOS_PARTITION=y CONFIG_NETDEVICES=y CONFIG_E1000=y CONFIG_SYS_NS16550=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/tricorder_defconfig b/configs/tricorder_defconfig index 0f6cccc..27a3b6e 100644 --- a/configs/tricorder_defconfig +++ b/configs/tricorder_defconfig @@ -40,4 +40,5 @@ CONFIG_NAND=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SYS_NS16550=y CONFIG_BCH=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/tricorder_flash_defconfig b/configs/tricorder_flash_defconfig index 7477b42..78afec0 100644 --- a/configs/tricorder_flash_defconfig +++ b/configs/tricorder_flash_defconfig @@ -39,4 +39,5 @@ CONFIG_NAND=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SYS_NS16550=y CONFIG_BCH=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/uniphier_ld4_sld8_defconfig b/configs/uniphier_ld4_sld8_defconfig index 542cebd..2f5c986 100644 --- a/configs/uniphier_ld4_sld8_defconfig +++ b/configs/uniphier_ld4_sld8_defconfig @@ -53,3 +53,4 @@ CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_PANIC_HANG=y diff --git a/configs/uniphier_v7_defconfig b/configs/uniphier_v7_defconfig index 9082ba5..42247cb 100644 --- a/configs/uniphier_v7_defconfig +++ b/configs/uniphier_v7_defconfig @@ -56,3 +56,4 @@ CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_UNIPHIER=y CONFIG_USB_STORAGE=y +CONFIG_PANIC_HANG=y diff --git a/configs/uniphier_v8_defconfig b/configs/uniphier_v8_defconfig index 746e451..007f4f3 100644 --- a/configs/uniphier_v8_defconfig +++ b/configs/uniphier_v8_defconfig @@ -53,3 +53,4 @@ CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_UNIPHIER=y CONFIG_USB_STORAGE=y +CONFIG_PANIC_HANG=y diff --git a/configs/xpedite517x_defconfig b/configs/xpedite517x_defconfig index a2324c3..3773518 100644 --- a/configs/xpedite517x_defconfig +++ b/configs/xpedite517x_defconfig @@ -27,4 +27,5 @@ CONFIG_DS4510=y CONFIG_MTD_NOR_FLASH=y CONFIG_PHYLIB=y CONFIG_SYS_NS16550=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/xpedite520x_defconfig b/configs/xpedite520x_defconfig index 7518ef2..7fffaa8 100644 --- a/configs/xpedite520x_defconfig +++ b/configs/xpedite520x_defconfig @@ -28,4 +28,5 @@ CONFIG_CMD_PCA953X=y CONFIG_MTD_NOR_FLASH=y CONFIG_PHYLIB=y CONFIG_SYS_NS16550=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/xpedite537x_defconfig b/configs/xpedite537x_defconfig index ead06a7..223bc4c 100644 --- a/configs/xpedite537x_defconfig +++ b/configs/xpedite537x_defconfig @@ -30,4 +30,5 @@ CONFIG_DS4510=y CONFIG_MTD_NOR_FLASH=y CONFIG_PHYLIB=y CONFIG_SYS_NS16550=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/configs/xpedite550x_defconfig b/configs/xpedite550x_defconfig index 80bc914..f3b9280 100644 --- a/configs/xpedite550x_defconfig +++ b/configs/xpedite550x_defconfig @@ -30,4 +30,5 @@ CONFIG_PHYLIB=y CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_STORAGE=y +CONFIG_PANIC_HANG=y CONFIG_OF_LIBFDT=y diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h index 661bc8b..b1b6725 100644 --- a/include/configs/B4860QDS.h +++ b/include/configs/B4860QDS.h @@ -173,7 +173,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/C29XPCIE.h b/include/configs/C29XPCIE.h index 7e805ec..f9d8cc6 100644 --- a/include/configs/C29XPCIE.h +++ b/include/configs/C29XPCIE.h @@ -117,7 +117,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 #define CONFIG_SYS_MEMTEST_END 0x00400000 -#define CONFIG_PANIC_HANG /* DDR Setup */ #define CONFIG_DDR_SPD diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index 3319a6f..ad339f1 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -69,7 +69,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00010000 /* skip exception vectors */ #define CONFIG_SYS_MEMTEST_END 0x1f000000 /* skip u-boot at top of RAM */ -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L2 Cache as L2 SRAM diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index 2aea892..8b8e1f5 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -46,7 +46,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_SYS_CCSRBAR 0xe0000000 #define CONFIG_SYS_CCSRBAR_PHYS_LOW CONFIG_SYS_CCSRBAR diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index b277cdb..634a9e1 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -58,7 +58,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00000000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x7fffffff -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L2 Cache as L2 SRAM diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index cbc15ae..d50035d 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -215,7 +215,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x1fffffff -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* DDR Setup */ #define CONFIG_SYS_DDR_RAW_TIMING diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h index 1b78a4f..17ae6cf 100644 --- a/include/configs/P1023RDB.h +++ b/include/configs/P1023RDB.h @@ -52,8 +52,6 @@ extern unsigned long get_clock_freq(void); #define CONFIG_SYS_MEMTEST_START 0x01000000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x02000000 -#define CONFIG_PANIC_HANG /* do not reset board on panic */ - /* Implement conversion of addresses in the LBC */ #define CONFIG_SYS_LBC_LBCR 0x00000000 #define CONFIG_SYS_LBC_LCRR LCRR_CLKDIV_8 diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h index 6008237..7e3a9f1 100644 --- a/include/configs/P2041RDB.h +++ b/include/configs/P2041RDB.h @@ -116,7 +116,6 @@ unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/T102xQDS.h b/include/configs/T102xQDS.h index 259e8a0..30632ca 100644 --- a/include/configs/T102xQDS.h +++ b/include/configs/T102xQDS.h @@ -196,7 +196,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h index 7dee2f0..791c6ef 100644 --- a/include/configs/T102xRDB.h +++ b/include/configs/T102xRDB.h @@ -219,7 +219,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/T1040QDS.h b/include/configs/T1040QDS.h index c694e50..4e75a3f 100644 --- a/include/configs/T1040QDS.h +++ b/include/configs/T1040QDS.h @@ -127,7 +127,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h index 2dbeffd..27a1439 100644 --- a/include/configs/T104xRDB.h +++ b/include/configs/T104xRDB.h @@ -226,7 +226,6 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_sd_rcw.cfg #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h index 625130a..ad192fe 100644 --- a/include/configs/T4240RDB.h +++ b/include/configs/T4240RDB.h @@ -96,7 +96,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h index 902abc4..a526f83 100644 --- a/include/configs/UCP1020.h +++ b/include/configs/UCP1020.h @@ -138,7 +138,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x1fffffff -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_SYS_CCSRBAR 0xffe00000 #define CONFIG_SYS_CCSRBAR_PHYS_LOW CONFIG_SYS_CCSRBAR diff --git a/include/configs/adp-ae3xx.h b/include/configs/adp-ae3xx.h index 5644a61..f75274e 100644 --- a/include/configs/adp-ae3xx.h +++ b/include/configs/adp-ae3xx.h @@ -21,7 +21,6 @@ #define CONFIG_SKIP_TRUNOFF_WATCHDOG #define CONFIG_CMDLINE_EDITING -#define CONFIG_PANIC_HANG #define CONFIG_ARCH_MAP_SYSMEM diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h index 0dbf149..a463235 100644 --- a/include/configs/corenet_ds.h +++ b/include/configs/corenet_ds.h @@ -128,7 +128,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/cyrus.h b/include/configs/cyrus.h index 1b20d85..685bff1 100644 --- a/include/configs/cyrus.h +++ b/include/configs/cyrus.h @@ -89,7 +89,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h index d2fa50a..e73d988 100644 --- a/include/configs/ls1012a_common.h +++ b/include/configs/ls1012a_common.h @@ -109,7 +109,6 @@ #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_MAXARGS 64 /* max command args */ -#define CONFIG_PANIC_HANG #define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */ #include diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index 6b71d47..e543903 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -228,8 +228,6 @@ unsigned long long get_qixis_addr(void); #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_MAXARGS 64 /* max command args */ -#define CONFIG_PANIC_HANG /* do not reset board on panic */ - #ifdef CONFIG_SPL #define CONFIG_SPL_BSS_START_ADDR 0x80100000 #define CONFIG_SPL_BSS_MAX_SIZE 0x00100000 diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h index f897869..ea74f4a 100644 --- a/include/configs/ls2080a_common.h +++ b/include/configs/ls2080a_common.h @@ -221,8 +221,6 @@ unsigned long long get_qixis_addr(void); #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_MAXARGS 64 /* max command args */ -#define CONFIG_PANIC_HANG /* do not reset board on panic */ - #define CONFIG_SPL_BSS_START_ADDR 0x80100000 #define CONFIG_SPL_BSS_MAX_SIZE 0x00100000 #define CONFIG_SPL_FRAMEWORK diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index 1b665b2..ac2921a 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -272,7 +272,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x1fffffff -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_SYS_CCSRBAR 0xffe00000 #define CONFIG_SYS_CCSRBAR_PHYS_LOW CONFIG_SYS_CCSRBAR diff --git a/include/configs/p1_twr.h b/include/configs/p1_twr.h index e969204..9792ba3 100644 --- a/include/configs/p1_twr.h +++ b/include/configs/p1_twr.h @@ -71,7 +71,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x1fffffff -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_SYS_CCSRBAR 0xffe00000 #define CONFIG_SYS_CCSRBAR_PHYS_LOW CONFIG_SYS_CCSRBAR diff --git a/include/configs/qemu-ppce500.h b/include/configs/qemu-ppce500.h index eb4cfae..8b78f08 100644 --- a/include/configs/qemu-ppce500.h +++ b/include/configs/qemu-ppce500.h @@ -31,7 +31,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* Needed to fill the ccsrbar pointer */ diff --git a/include/configs/t4qds.h b/include/configs/t4qds.h index 4938f43..47b78a2 100644 --- a/include/configs/t4qds.h +++ b/include/configs/t4qds.h @@ -54,7 +54,6 @@ #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */ #define CONFIG_SYS_MEMTEST_END 0x00400000 #define CONFIG_SYS_ALT_MEMTEST -#define CONFIG_PANIC_HANG /* do not reset board on panic */ /* * Config the L3 Cache as L3 SRAM diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index d9ab91c..f892a57 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -90,7 +90,6 @@ /* hang() the board on panic() */ -#define CONFIG_PANIC_HANG /* environment placement (for NAND), is different for FLASHCARD but does not * harm there */ diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 453f3db..12cbe9b 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -218,8 +218,6 @@ /* for LD20; the last 64 byte is used for dynamic DDR PHY training */ #define CONFIG_SYS_MEM_TOP_HIDE 64 -#define CONFIG_PANIC_HANG - #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE) /* only for SPL */ diff --git a/include/configs/xpedite517x.h b/include/configs/xpedite517x.h index beedc9e..4326984 100644 --- a/include/configs/xpedite517x.h +++ b/include/configs/xpedite517x.h @@ -487,7 +487,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */ #define CONFIG_CMDLINE_EDITING 1 /* Command-line editing */ #define CONFIG_LOADADDR 0x1000000 /* default location for tftp and bootm */ -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_PREBOOT /* enable preboot variable */ #define CONFIG_INTEGRITY /* support booting INTEGRITY OS */ diff --git a/include/configs/xpedite520x.h b/include/configs/xpedite520x.h index f589d1d..5a56162 100644 --- a/include/configs/xpedite520x.h +++ b/include/configs/xpedite520x.h @@ -291,7 +291,6 @@ #define CONFIG_CMDLINE_EDITING 1 /* add command line history */ #define CONFIG_AUTO_COMPLETE 1 /* add autocompletion support */ #define CONFIG_LOADADDR 0x1000000 /* default location for tftp and bootm */ -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_PREBOOT /* enable preboot variable */ #define CONFIG_INTEGRITY /* support booting INTEGRITY OS */ #define CONFIG_INTERRUPTS /* enable pci, srio, ddr interrupts */ diff --git a/include/configs/xpedite537x.h b/include/configs/xpedite537x.h index d217eb3..b262237 100644 --- a/include/configs/xpedite537x.h +++ b/include/configs/xpedite537x.h @@ -341,7 +341,6 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy); #define CONFIG_CMDLINE_EDITING 1 /* add command line history */ #define CONFIG_AUTO_COMPLETE 1 /* add autocompletion support */ #define CONFIG_LOADADDR 0x1000000 /* default location for tftp and bootm */ -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_PREBOOT /* enable preboot variable */ #define CONFIG_INTEGRITY /* support booting INTEGRITY OS */ diff --git a/include/configs/xpedite550x.h b/include/configs/xpedite550x.h index 6c0981b..624e9a8 100644 --- a/include/configs/xpedite550x.h +++ b/include/configs/xpedite550x.h @@ -339,7 +339,6 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy); #define CONFIG_CMDLINE_EDITING 1 /* add command line history */ #define CONFIG_AUTO_COMPLETE 1 /* add autocompletion support */ #define CONFIG_LOADADDR 0x1000000 /* default location for tftp and bootm */ -#define CONFIG_PANIC_HANG /* do not reset board on panic */ #define CONFIG_PREBOOT /* enable preboot variable */ #define CONFIG_INTEGRITY /* support booting INTEGRITY OS */ diff --git a/include/configs/xtfpga.h b/include/configs/xtfpga.h index 3050f17..3119f00 100644 --- a/include/configs/xtfpga.h +++ b/include/configs/xtfpga.h @@ -130,10 +130,6 @@ #define CONFIG_MX_CYCLIC #define CONFIG_SHOW_BOOT_PROGRESS -#ifdef DEBUG -#define CONFIG_PANIC_HANG 1 /* Require manual reboot */ -#endif - /*=========================================*/ /* FPGA Registers (board info and control) */ diff --git a/lib/Kconfig b/lib/Kconfig index f447c53..00ac650 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -45,6 +45,16 @@ config USE_TINY_PRINTF The supported format specifiers are %c, %s, %u/%d and %x. +config PANIC_HANG + bool "Do not reset the system on fatal error" + help + Define this option to stop the system in case of a fatal error, + so that you have to reset it manually. This is probably NOT a good + idea for an embedded system where you want the system to reboot + automatically as fast as possible, but it may be useful during + development since you can try to debug the conditions that lead to + the situation. + config REGEX bool "Enable regular expression support" default y if NET From patchwork Mon Dec 4 03:37:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 120488 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3947738qgn; Sun, 3 Dec 2017 19:39:51 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ/LqVDcIni7jDjtp+ZBCnthyJ416kB0p71RvUA3bzpLlMzHWXxvq0Ky/ARPU6E8RPNTmFZ X-Received: by 10.80.201.12 with SMTP id o12mr28296942edh.90.1512358791760; Sun, 03 Dec 2017 19:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512358791; cv=none; d=google.com; s=arc-20160816; b=GdX3YFkQQdDeZngn/sCBzXVl+2QeHwDtTpOrJuW5x+RoRDKGCBoKDDwH+ldEPxvl26 C7z0R8zpIWpTmXbbLy6o7ZCLgPvoSoIb3xBXV0Ksm0nPpJWYwLN8NOmkWjFbQhN4NKEz vKBnNG3qZkkqcqwSkhB2oFko2JI68P7PqxGlxo23G5DK/KDViaQgD2UxajbMcCZCsBNL aZa3cDSwFYY4+fvJ30IW51zcsgjjZG4mwFzA6vDK/nvZOVwOjZA5h2c20uqdy7NEgJL/ QD7GeKDA9p2BwSnM00f4GJh6c7t7r5SN9X93LNENrYWPAhkWwRqpwhAqBphmJScy0Vzp 7WDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=MvG+pXTo4aM9Kk/d5hOCvRSh4cEvH8rmLXs1tnDH2Wc=; b=MNkgbvZ8RI9O3GQyEXZ6J6TTp6uewc/FHd/iX6PA5vfwS++Db57xCU2zgUc7yQ6tz8 rnjUv8f95aQVP2jiZTNCVOVIa3iEglGqTAuptlzLgW6pN8KsT5JOUYSosWBn/fcsZpl+ iNb9V/MvAb1US6EDzyXFpN/isrdv/wn9e2h+oW4aZzzTumC39IsV7xHdT8RwE2dI8Nzw V6Zi0WtOouyI4BQq3KF7kYOh+Lc1JzQ+Knaq/usV4x9CwNcJ9ZRVS3ivMD95u5Z1YV5O hiiIJ6VeikuJY9n8synTv04jRge+drGOTmU66xgbhBX3oEZal3zJA5Oh8496YeW+unbq /fKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=sheEVwuu; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id l93si159669ede.535.2017.12.03.19.39.51; Sun, 03 Dec 2017 19:39:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=sheEVwuu; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 492E3C22035; Mon, 4 Dec 2017 03:38:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C6BD3C22050; Mon, 4 Dec 2017 03:38:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 821FFC21FA6; Mon, 4 Dec 2017 03:37:59 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id AA723C22016 for ; Mon, 4 Dec 2017 03:37:58 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id vB43bE4q022247; Mon, 4 Dec 2017 12:37:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com vB43bE4q022247 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1512358638; bh=dAF24NWJ99hlnOEZnN+0cDQHz6XwXH2+9XHL5FqaMBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sheEVwuu0E2gjnjH8Uhh+mnd0GPqzg5I5p0brKtoZA3OOnqDD+94gVNVvDKPIQgSM YsUqB8/9kOXBT8jj/UvFR7sahePdKl9D4Kc6fJolvSOn7umLjROcn6/4JIehxKKImU ehyGnWLl3ZD64IUBGv6SO7VWmkqAXd1m5UifCFr51EdGNJ60jUJzLveAzAceX6/lup C27JRRbDoQTSrTUD6qJsRFQgTq8L9Uyi6oWr5DgdGqH2PcMXoMr6cSCBoEyui03zPr GP2JJntS6jTf1xJivFFFNvDjlwJ3VpjvjkM7KihPQbOpEFNimUJ3B17XHvzeTsrZ7k 2DrLSGJblZMsw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 4 Dec 2017 12:37:01 +0900 Message-Id: <1512358624-6309-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> References: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> Cc: Marek Vasut , Tom Rini Subject: [U-Boot] [PATCH v2 2/5] Enable CONFIG_PANIC_HANG for boards without do_reset() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Calling panic() for these boards causes build error: undefined reference to `do_reset' They must compile do_reset(), or define CONFIG_PANIC_HANG. Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- Changes in v2: None configs/cl-som-imx7_defconfig | 1 + configs/evb-rk3229_defconfig | 1 + configs/mccmon6_sd_defconfig | 1 + configs/opos6uldev_defconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/configs/cl-som-imx7_defconfig b/configs/cl-som-imx7_defconfig index d37c82c..150396f 100644 --- a/configs/cl-som-imx7_defconfig +++ b/configs/cl-som-imx7_defconfig @@ -51,3 +51,4 @@ CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_CI_UDC=y CONFIG_OF_LIBFDT=y +CONFIG_PANIC_HANG=y diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index b226f66..21c1bfd 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -48,3 +48,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_ERRNO_STR=y +CONFIG_PANIC_HANG=y diff --git a/configs/mccmon6_sd_defconfig b/configs/mccmon6_sd_defconfig index 97f7f9a..3f00ead 100644 --- a/configs/mccmon6_sd_defconfig +++ b/configs/mccmon6_sd_defconfig @@ -44,3 +44,4 @@ CONFIG_DM_THERMAL=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_PANIC_HANG=y diff --git a/configs/opos6uldev_defconfig b/configs/opos6uldev_defconfig index 0149ae3..51ebc73 100644 --- a/configs/opos6uldev_defconfig +++ b/configs/opos6uldev_defconfig @@ -84,3 +84,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_VIDEO=y CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER is not set +CONFIG_PANIC_HANG=y From patchwork Mon Dec 4 03:37:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 120486 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3946870qgn; Sun, 3 Dec 2017 19:38:09 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ39W0k1+V37hBlu+tm+4CZvBVm4nZYsfC4H5b/QSBesDKGywW4HDTD5b5WUeD3W7M58itf X-Received: by 10.80.170.24 with SMTP id o24mr29440002edc.40.1512358689217; Sun, 03 Dec 2017 19:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512358689; cv=none; d=google.com; s=arc-20160816; b=SJOKZEVWabMfeVRG16QU/nyVBX0RSSmWGvdXg+kKxr/3Hm2wMGVIySBhayI+PplEpK qRH1z2hUL7fdm5Hn4oNT7zsk5iF984sCnLqLdc+zIQosumDeDaSTqEuESozaDrVp9YII y2mUETneHIHCnr35HPmXwxXEvN2Z4lD86UWwLxwQRCIoz0IqFc/Nhs2EFe3RVEPBEJq/ +MIeJ/QNTisQ8KripmoWuRaub8+RZv9YqVNOUhS9Y2rasK91inZofTPXU2GbCZ4qozhJ vnsORZkKryG7yInm+ku0Dpm4JUYIKCGvcD2SypDXah9hv36wzVcu7Wf8fc8Gdz84RunK SQmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=UwL0V/ZCfceDMgGoM4jv3AjruqIxJoDnSb9NKubRYIQ=; b=rBQY8n3snl9MDVBtxePrBgfcVR9oZwInwTW6+d9gxeUqLiSeA42Q6TWJmbYUicqt8l dCA+YTC53sj+mSwI5WK6aagrwnX+iaWLbYysUQQxWaIpcDo//stNvw9nk7n8ydW1telb qysE8BjsuHlTI9cDWGBcnGoQQ6Di7MVWd44GC4m4/5g15rBMPvNCOHfxrCzeKuhrmPNM it45LCZrDhHWDPOITwEv8uI+NDewNY5+XZQTJHdnbXtfUAaD1Ke0+SKGo/sBZrsehnIh 9ozYX8Wiq9liO6Oiip8SRAYYuNHG8vG4iOiZafrrlUiwwh+3hGwNe56fNb4t16/ae74P adXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=g3dU2ize; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id c14si2144591edj.440.2017.12.03.19.38.08; Sun, 03 Dec 2017 19:38:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=g3dU2ize; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 48CE1C22033; Mon, 4 Dec 2017 03:38:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1BC9FC21FA6; Mon, 4 Dec 2017 03:38:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4ECF2C22017; Mon, 4 Dec 2017 03:37:59 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 679C1C21FA6 for ; Mon, 4 Dec 2017 03:37:58 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id vB43bE4r022247; Mon, 4 Dec 2017 12:37:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com vB43bE4r022247 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1512358639; bh=Gi/ht9c3fyn/8Akvk6mMZQPpPxMdcH+IhacxlC4Sspg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3dU2izeC7EujLUktrf99jF56OzacXVICNvbiJ1sbKayd7lmz8dHJMtP/l9YV2/Cm aeNpBRmRXAh3GThefI1gL06yVcEgi+NgLbS09oTFbplWZ72YdFjdNWNNxd5UcH4isv T4kw7XF9Wbriv2FFJzOmR6CWjwaRPeqMtZ9FB9VyRpGoTJztn8lGu3A9r1pHETHb8+ aUlOZxuML29qzGDfVqvpFPloRLcKmaCK4GQ08AxWuhg7vi9Lm4VQslmoTr3Jj9RSwT DOmSW6tCzQGMMVSwN3Cdf0CsZbVHZHQdQWvE0wgP4QS13Lb3TNrwyeC/tFC8K3IMlB PizUmc8XOO6XQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 4 Dec 2017 12:37:02 +0900 Message-Id: <1512358624-6309-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> References: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> Cc: Marek Vasut , Tom Rini Subject: [U-Boot] [PATCH v2 3/5] Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" BUG() and BUG_ON() are generally used to test a condition that should never happen. If it does, it is a bug. Linux always enables them, but doing so in U-Boot causes image size problems on some platforms. Introduce CONFIG_ENABLE_BUG_CHECKS to make them no-op by default. Platforms without image size constraint are free to enable this option to catch bugs easily. Likewise, silence WARN_ON() unless this option is enabled. Suggested-by: Tom Rini Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- Changes in v2: - Newly added include/linux/bug.h | 9 ++++++++- lib/Kconfig | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/linux/bug.h b/include/linux/bug.h index f07bb71..ac1c7de 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h @@ -6,17 +6,24 @@ #include #include +#ifdef CONFIG_ENABLE_BUG_CHECKS #define BUG() do { \ printk("BUG at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ panic("BUG!"); \ } while (0) +#define __WARN() \ + printk("WARNING at %s:%d/%s()!\n", __FILE__, __LINE__, __func__) +#else +#define BUG() +#define __WARN() +#endif #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) #define WARN_ON(condition) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ - printk("WARNING at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ + __WARN(); \ unlikely(__ret_warn_on); \ }) diff --git a/lib/Kconfig b/lib/Kconfig index 00ac650..36b1b3b 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -45,6 +45,13 @@ config USE_TINY_PRINTF The supported format specifiers are %c, %s, %u/%d and %x. +config ENABLE_BUG_CHECKS + bool "Enable BUG/BUG_ON() checks and WARN_ON() logs" + help + BUG() and BUG_ON() are no-op by default. This option enables + them to print noisy messages, then reboot or halt the system. + It also enables WARN_ON() messages. + config PANIC_HANG bool "Do not reset the system on fatal error" help From patchwork Mon Dec 4 03:37:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 120508 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4308946qgn; Mon, 4 Dec 2017 03:32:16 -0800 (PST) X-Google-Smtp-Source: AGs4zMZA01jHOb5rQu0DESsuyWfmDD2sr79iM2IRQRcHDm9P/BAENdCgnpBHqc86teYZcC/cZ0+P X-Received: by 10.80.157.134 with SMTP id w6mr31288282ede.151.1512387136140; Mon, 04 Dec 2017 03:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512387136; cv=none; d=google.com; s=arc-20160816; b=PlxDDOhABQBzcja1fAW3bnuj6f/SusUaRZDclwjoVI5hM0OI7dtRoLzgiYxs53qGL8 B6gyNXxtGh2E3tZ9raGEQPWSIA9SgaxTGS5HhD6fji1Ftz72eC2dL7Hx2uer1NXPjQLW NHZHM0GeuJt+Vf/AxVlKAgJLgd101Tnxvx/kXPzp0cJQ1qwUalXU3kmKW28FnO8WR90e 3LbKThZal8Rw7Pe9onHjjYbDaCSiAPxprjYnU7AbmtLiSfx0CEBs4UyOzQAPcstQJbJx qMXyH+BAu1phYp1b3IywdBKQfsD3RK+vhRpEVipzVJr8GdntzCRcc94TUNIffL0LINeK P2ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=wShHlXsiKtd6WhpvU2+yfnQvXpTP2sXD8hvnokPR1vw=; b=dEXmmrwT1nqT72xAm9OnzeZoXYvYenYbKfzw0seGfCVcF9rnJExUvUoW1v4Zl+JQ7u BZKYxd/Z4iL3eHhdwTc3QeKJeNsY7LjWkqzS2Hj9zLkN4Y76cP5vzqdxxRoIbFxkNRI4 Pl1GGDTb3wrdbvVo7NO5RQOs0HZY3DQpiYUSAvl+3oeboMMCMMbkUtQf5ShtpVh/HtxY PTjU/tUaLjUUHpATrkXw0KSi8AO9w9iZBf/v4lbJ8l9SkeUQWST6aCJGEMefij2adppx ny1MFfn02IAxDBpNbMO31QZVVE7RiATN62hyZsi8XaRdjTzNSPh7OoCevVFKqDiB8UWB 8CbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=0ZLDPhLb; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id m13si3852917edd.71.2017.12.04.03.32.15; Mon, 04 Dec 2017 03:32:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=0ZLDPhLb; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id DAE86C22050; Mon, 4 Dec 2017 11:32:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 42508C21E32; Mon, 4 Dec 2017 11:31:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B8C5BC2203A; Mon, 4 Dec 2017 03:38:37 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 9EA30C2201C for ; Mon, 4 Dec 2017 03:38:30 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id vB43bE4s022247; Mon, 4 Dec 2017 12:37:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com vB43bE4s022247 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1512358640; bh=RefjHyfbGfnRD76qPwjyeOgm9+mwOEt5AWPLCMh85rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ZLDPhLbwz0E4WL1SmhjAvaX3zvh5mNVEj4RvNNqMNIw4VJGU/4aJ9wBl5ln00Zk+ WmxUmP1pzbAVEUOIY7nN7YtNtDg80oSUEw0jjn7CAnjUW83OSmRxZSx2XzBovivzUf nUL7+TexqpO5/3BjUZgy46aKB7HNGIKCBn3C5p7O4Ohmfp4Hcn+2/6UYCK1gErB0bi QPSyU7VyCy6iMbwRqFIMM3Gc8edYgNUcrRiruKB3VfI1nH8Ck6rlEXfk1NC0YHqYtY 3eHvhYYPNFFQc90PAEXMa/ObygehXsDOh7HpQ3OIAPErUCiIQ1LdbDemXEzM4U014m H+gSqqYoasVig== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 4 Dec 2017 12:37:03 +0900 Message-Id: <1512358624-6309-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> References: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> X-Mailman-Approved-At: Mon, 04 Dec 2017 11:31:54 +0000 Cc: Marek Vasut , Tom Rini , Joe Hershberger , Alexander Graf , Scott Wood , Tom Warren , Jagan Teki Subject: [U-Boot] [PATCH v2 4/5] treewide: convert assert() to BUG_ON() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We do not need multiple ways to do the same thing. Instead of assert(), use BUG_ON() from Linux. The logic is opposite, but Coccinelle is of great help for such a conversion. We could simply convert assert(x) to BUG_ON(!x) for all expressions "x", but I did a bit better job by converting assert(a == b) to BUG_ON(a != b), etc. The semantic patch I used is as follows: // @@@@ -assert(0) +BUG() @@ expression a; @@ -assert((a)) +assert(a) @@ expression a; @@ -assert(a == 0) +BUG_ON(a) @@ expression a; @@ -assert(a == NULL) +BUG_ON(a) @@ expression a; @@ -assert(a != 0) +BUG_ON(!a) @@ expression a; @@ -assert(a != NULL) +BUG_ON(!a) @@ expression a, b; @@ -assert(a == b) +BUG_ON(a != b) @@ expression a, b; @@ -assert(a != b) +BUG_ON(a == b) @@ expression a, b; @@ -assert(a < b) +BUG_ON(a >= b) @@ expression a, b; @@ -assert(a <= b) +BUG_ON(a > b) @@ expression a; @@ -assert(!a) +BUG_ON(a) @@ expression a; @@ -assert(a) +BUG_ON(!a) // Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- Changes in v2: - Improve semantic patch and re-run coccinelle based on commit 02907004294d98 arch/arm/mach-exynos/clock.c | 4 +- arch/arm/mach-tegra/clock.c | 10 ++-- arch/arm/mach-tegra/pinmux-common.c | 80 +++++++++++++-------------- arch/arm/mach-tegra/tegra114/clock.c | 10 ++-- arch/arm/mach-tegra/tegra124/clock.c | 10 ++-- arch/arm/mach-tegra/tegra20/clock.c | 14 ++--- arch/arm/mach-tegra/tegra210/clock.c | 10 ++-- arch/arm/mach-tegra/tegra30/clock.c | 10 ++-- arch/sandbox/cpu/state.c | 4 +- arch/x86/cpu/intel_common/mrc.c | 2 +- arch/x86/lib/efi/efi.c | 2 +- arch/x86/lib/fsp/fsp_support.c | 6 +- arch/x86/lib/physmem.c | 5 +- board/freescale/qemu-ppce500/qemu-ppce500.c | 8 +-- cmd/bootefi.c | 2 +- cmd/mtdparts.c | 2 +- cmd/tpm_test.c | 28 +++++----- common/dlmalloc.c | 86 ++++++++++++++--------------- common/fdt_support.c | 2 +- common/hwconfig.c | 36 ++++++------ drivers/clk/clk-uclass.c | 2 +- drivers/clk/rockchip/clk_rk3036.c | 23 ++++---- drivers/clk/rockchip/clk_rk3128.c | 27 ++++----- drivers/clk/rockchip/clk_rk3188.c | 28 ++++------ drivers/clk/rockchip/clk_rk322x.c | 23 ++++---- drivers/clk/rockchip/clk_rk3288.c | 36 +++++------- drivers/clk/rockchip/clk_rk3328.c | 8 +-- drivers/clk/rockchip/clk_rk3368.c | 4 +- drivers/clk/rockchip/clk_rk3399.c | 51 +++++++---------- drivers/clk/rockchip/clk_rv1108.c | 2 +- drivers/core/device-remove.c | 8 +-- drivers/core/device.c | 2 +- drivers/core/ofnode.c | 24 ++++---- drivers/core/uclass.c | 4 +- drivers/gpio/gpio-uclass.c | 2 +- drivers/i2c/i2c-uclass.c | 2 +- drivers/input/input.c | 4 +- drivers/input/key_matrix.c | 2 +- drivers/misc/cros_ec.c | 10 ++-- drivers/misc/cros_ec_i2c.c | 4 +- drivers/mtd/nand/tegra_nand.c | 2 +- drivers/mtd/spi/sandbox.c | 4 +- drivers/net/fsl-mc/mc.c | 2 +- drivers/phy/phy-uclass.c | 2 +- drivers/power/tps6586x.c | 4 +- drivers/rtc/rtc-uclass.c | 10 ++-- drivers/sound/sound.c | 2 +- drivers/spi/exynos_spi.c | 6 +- drivers/usb/emul/sandbox_flash.c | 2 +- drivers/usb/host/usb-uclass.c | 4 +- drivers/video/stb_truetype.h | 2 +- fs/ext4/dev.c | 2 +- fs/ext4/ext4_common.c | 2 +- fs/ext4/ext4_journal.c | 2 +- fs/fat/fat.c | 2 +- include/dm/ofnode.h | 4 +- include/efi_loader.h | 12 ++-- lib/circbuf.c | 16 +++--- lib/efi_loader/efi_boottime.c | 2 +- lib/efi_loader/efi_device_path.c | 2 +- lib/efi_loader/efi_file.c | 2 +- lib/efi_loader/efi_memory.c | 2 +- lib/fdtdec.c | 8 +-- lib/membuff.c | 4 +- lib/physmem.c | 4 +- lib/qsort.c | 2 +- lib/slre.c | 8 +-- net/eth-uclass.c | 2 +- net/eth_legacy.c | 2 +- net/net.c | 2 +- test/command_ut.c | 30 +++++----- test/compression.c | 16 +++--- test/print_ut.c | 42 +++++++------- 73 files changed, 383 insertions(+), 422 deletions(-) diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c index 3d31f9d..a146103 100644 --- a/arch/arm/mach-exynos/clock.c +++ b/arch/arm/mach-exynos/clock.c @@ -1405,8 +1405,8 @@ static int clock_calc_best_scalar(unsigned int main_scaler_bits, debug("Input Rate is %u, Target is %u, Cap is %u\n", input_rate, target_rate, cap); - assert(best_fine_scalar != NULL); - assert(main_scaler_bits <= fine_scalar_bits); + BUG_ON(!best_fine_scalar); + BUG_ON(main_scaler_bits > fine_scalar_bits); *best_fine_scalar = 1; diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index dc58b30..47cf867 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -74,7 +74,7 @@ static struct clk_pll *get_pll(enum clock_id clkid) struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; - assert(clock_id_is_pll(clkid)); + BUG_ON(!clock_id_is_pll(clkid)); if (clkid >= (enum clock_id)TEGRA_CLK_PLLS) { debug("%s: Invalid PLL %d\n", __func__, clkid); return NULL; @@ -94,7 +94,7 @@ int clock_ll_read_pll(enum clock_id clkid, u32 *divm, u32 *divn, struct clk_pll_info *pllinfo = &tegra_pll_info_table[clkid]; u32 data; - assert(clkid != CLOCK_ID_USB); + BUG_ON(clkid == CLOCK_ID_USB); /* Safety check, adds to code size but is small */ if (!clock_id_is_pll(clkid) || clkid == CLOCK_ID_USB) @@ -454,7 +454,7 @@ unsigned clock_adjust_periph_pll_div(enum periph_id periph_id, if (extra_div) *extra_div = xdiv; - assert(divider >= 0); + BUG_ON(0 > divider); if (adjust_periph_pll(periph_id, source, mux_bits, divider)) return -1U; debug("periph %d, rate=%d, reg=%p = %x\n", periph_id, rate, @@ -515,7 +515,7 @@ void reset_cmplx_set_enable(int cpu, int which, int reset) u32 mask; /* Form the mask, which depends on the cpu chosen (2 or 4) */ - assert(cpu >= 0 && cpu < MAX_NUM_CPU); + BUG_ON(!(cpu >= 0 && cpu < MAX_NUM_CPU)); mask = which << cpu; /* either enable or disable those reset for that CPU */ @@ -665,7 +665,7 @@ int clock_decode_periph_id(struct udevice *dev) if (err) return -1; id = clk_id_to_periph_id(cell[1]); - assert(clock_periph_id_isvalid(id)); + BUG_ON(!clock_periph_id_isvalid(id)); return id; } #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ diff --git a/arch/arm/mach-tegra/pinmux-common.c b/arch/arm/mach-tegra/pinmux-common.c index 5862c4a..1478a03 100644 --- a/arch/arm/mach-tegra/pinmux-common.c +++ b/arch/arm/mach-tegra/pinmux-common.c @@ -165,8 +165,8 @@ void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func) return; /* Error check on pin and func */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_func_isvalid(func)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_func_isvalid(func)); if (func >= PMUX_FUNC_RSVD1) { mux = (func - PMUX_FUNC_RSVD1) & 3; @@ -179,7 +179,7 @@ void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func) } } } - assert(mux != -1); + BUG_ON(mux == -1); val = readl(reg); val &= ~(3 << MUX_SHIFT(pin)); @@ -193,8 +193,8 @@ void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd) u32 val; /* Error check on pin and pupd */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_pupd_isvalid(pupd)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_pupd_isvalid(pupd)); val = readl(reg); val &= ~(3 << PULL_SHIFT(pin)); @@ -208,8 +208,8 @@ static void pinmux_set_tristate(enum pmux_pingrp pin, int tri) u32 val; /* Error check on pin */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_tristate_isvalid(tri)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_tristate_isvalid(tri)); val = readl(reg); if (tri == PMUX_TRI_TRISTATE) @@ -239,8 +239,8 @@ void pinmux_set_io(enum pmux_pingrp pin, enum pmux_pin_io io) return; /* Error check on pin and io */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_io_isvalid(io)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_io_isvalid(io)); val = readl(reg); if (io == PMUX_PIN_INPUT) @@ -261,8 +261,8 @@ static void pinmux_set_lock(enum pmux_pingrp pin, enum pmux_pin_lock lock) return; /* Error check on pin and lock */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_lock_isvalid(lock)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_lock_isvalid(lock)); val = readl(reg); if (lock == PMUX_PIN_LOCK_ENABLE) { @@ -288,8 +288,8 @@ static void pinmux_set_od(enum pmux_pingrp pin, enum pmux_pin_od od) return; /* Error check on pin and od */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_od_isvalid(od)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_od_isvalid(od)); val = readl(reg); if (od == PMUX_PIN_OD_ENABLE) @@ -313,8 +313,8 @@ static void pinmux_set_ioreset(enum pmux_pingrp pin, return; /* Error check on pin and ioreset */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_ioreset_isvalid(ioreset)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_ioreset_isvalid(ioreset)); val = readl(reg); if (ioreset == PMUX_PIN_IO_RESET_ENABLE) @@ -338,8 +338,8 @@ static void pinmux_set_rcv_sel(enum pmux_pingrp pin, return; /* Error check on pin and rcv_sel */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_rcv_sel_isvalid(rcv_sel)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_rcv_sel_isvalid(rcv_sel)); val = readl(reg); if (rcv_sel == PMUX_PIN_RCV_SEL_HIGH) @@ -363,8 +363,8 @@ static void pinmux_set_e_io_hv(enum pmux_pingrp pin, return; /* Error check on pin and e_io_hv */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_pin_e_io_hv_isvalid(e_io_hv)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_pin_e_io_hv_isvalid(e_io_hv)); val = readl(reg); if (e_io_hv == PMUX_PIN_E_IO_HV_HIGH) @@ -388,8 +388,8 @@ static void pinmux_set_schmt(enum pmux_pingrp pin, enum pmux_schmt schmt) return; /* Error check pad */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_schmt_isvalid(schmt)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_schmt_isvalid(schmt)); val = readl(reg); if (schmt == PMUX_SCHMT_ENABLE) @@ -413,8 +413,8 @@ static void pinmux_set_hsm(enum pmux_pingrp pin, enum pmux_hsm hsm) return; /* Error check pad */ - assert(pmux_pingrp_isvalid(pin)); - assert(pmux_hsm_isvalid(hsm)); + BUG_ON(!pmux_pingrp_isvalid(pin)); + BUG_ON(!pmux_hsm_isvalid(hsm)); val = readl(reg); if (hsm == PMUX_HSM_ENABLE) @@ -523,8 +523,8 @@ static void pinmux_set_drvup_slwf(enum pmux_drvgrp grp, int slwf) return; /* Error check on pad and slwf */ - assert(pmux_drvgrp_isvalid(grp)); - assert(pmux_slw_isvalid(slwf)); + BUG_ON(!pmux_drvgrp_isvalid(grp)); + BUG_ON(!pmux_slw_isvalid(slwf)); val = readl(reg); val &= ~SLWF_MASK; @@ -544,8 +544,8 @@ static void pinmux_set_drvdn_slwr(enum pmux_drvgrp grp, int slwr) return; /* Error check on pad and slwr */ - assert(pmux_drvgrp_isvalid(grp)); - assert(pmux_slw_isvalid(slwr)); + BUG_ON(!pmux_drvgrp_isvalid(grp)); + BUG_ON(!pmux_slw_isvalid(slwr)); val = readl(reg); val &= ~SLWR_MASK; @@ -565,8 +565,8 @@ static void pinmux_set_drvup(enum pmux_drvgrp grp, int drvup) return; /* Error check on pad and drvup */ - assert(pmux_drvgrp_isvalid(grp)); - assert(pmux_drv_isvalid(drvup)); + BUG_ON(!pmux_drvgrp_isvalid(grp)); + BUG_ON(!pmux_drv_isvalid(drvup)); val = readl(reg); val &= ~DRVUP_MASK; @@ -586,8 +586,8 @@ static void pinmux_set_drvdn(enum pmux_drvgrp grp, int drvdn) return; /* Error check on pad and drvdn */ - assert(pmux_drvgrp_isvalid(grp)); - assert(pmux_drv_isvalid(drvdn)); + BUG_ON(!pmux_drvgrp_isvalid(grp)); + BUG_ON(!pmux_drv_isvalid(drvdn)); val = readl(reg); val &= ~DRVDN_MASK; @@ -608,8 +608,8 @@ static void pinmux_set_lpmd(enum pmux_drvgrp grp, enum pmux_lpmd lpmd) return; /* Error check pad and lpmd value */ - assert(pmux_drvgrp_isvalid(grp)); - assert(pmux_lpmd_isvalid(lpmd)); + BUG_ON(!pmux_drvgrp_isvalid(grp)); + BUG_ON(!pmux_lpmd_isvalid(lpmd)); val = readl(reg); val &= ~LPMD_MASK; @@ -631,8 +631,8 @@ static void pinmux_set_schmt(enum pmux_drvgrp grp, enum pmux_schmt schmt) return; /* Error check pad */ - assert(pmux_drvgrp_isvalid(grp)); - assert(pmux_schmt_isvalid(schmt)); + BUG_ON(!pmux_drvgrp_isvalid(grp)); + BUG_ON(!pmux_schmt_isvalid(schmt)); val = readl(reg); if (schmt == PMUX_SCHMT_ENABLE) @@ -656,8 +656,8 @@ static void pinmux_set_hsm(enum pmux_drvgrp grp, enum pmux_hsm hsm) return; /* Error check pad */ - assert(pmux_drvgrp_isvalid(grp)); - assert(pmux_hsm_isvalid(hsm)); + BUG_ON(!pmux_drvgrp_isvalid(grp)); + BUG_ON(!pmux_hsm_isvalid(hsm)); val = readl(reg); if (hsm == PMUX_HSM_ENABLE) @@ -714,8 +714,8 @@ static void pinmux_mipipadctrl_set_func(enum pmux_mipipadctrlgrp grp, return; /* Error check grp and func */ - assert(pmux_mipipadctrlgrp_isvalid(grp)); - assert(pmux_func_isvalid(func)); + BUG_ON(!pmux_mipipadctrlgrp_isvalid(grp)); + BUG_ON(!pmux_func_isvalid(func)); if (func >= PMUX_FUNC_RSVD1) { mux = (func - PMUX_FUNC_RSVD1) & 1; @@ -729,7 +729,7 @@ static void pinmux_mipipadctrl_set_func(enum pmux_mipipadctrlgrp grp, } } } - assert(mux != -1); + BUG_ON(mux == -1); val = readl(reg); val &= ~(1 << 1); diff --git a/arch/arm/mach-tegra/tegra114/clock.c b/arch/arm/mach-tegra/tegra114/clock.c index 177ab6b..0f91141 100644 --- a/arch/arm/mach-tegra/tegra114/clock.c +++ b/arch/arm/mach-tegra/tegra114/clock.c @@ -486,9 +486,9 @@ u32 *get_periph_source_reg(enum periph_id periph_id) if (periph_id == PERIPH_ID_CSI) return &clkrst->crc_clk_src[PERIPH_ID_CSI+1]; - assert(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT); + BUG_ON(!(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT)); internal_id = periph_id_to_internal_id[periph_id]; - assert(internal_id != -1); + BUG_ON(internal_id == -1); if (internal_id >= PERIPHC_VW_FIRST) { internal_id -= PERIPHC_VW_FIRST; return &clkrst->crc_clk_src_vw[internal_id]; @@ -560,7 +560,7 @@ int get_periph_clock_source(enum periph_id periph_id, int mux, err; err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type); - assert(!err); + BUG_ON(err); for (mux = 0; mux < CLOCK_MAX_MUX; mux++) if (clock_source[type][mux] == parent) @@ -580,7 +580,7 @@ void clock_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable the clock to this peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if ((int)periph_id < (int)PERIPH_ID_VW_FIRST) clk = &clkrst->crc_clk_out_enb[PERIPH_REG(periph_id)]; else @@ -601,7 +601,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable reset to the peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if (periph_id < PERIPH_ID_VW_FIRST) reset = &clkrst->crc_rst_dev[PERIPH_REG(periph_id)]; else diff --git a/arch/arm/mach-tegra/tegra124/clock.c b/arch/arm/mach-tegra/tegra124/clock.c index 5ae718b..2108273 100644 --- a/arch/arm/mach-tegra/tegra124/clock.c +++ b/arch/arm/mach-tegra/tegra124/clock.c @@ -628,9 +628,9 @@ u32 *get_periph_source_reg(enum periph_id periph_id) if (periph_id == PERIPH_ID_CSI) return &clkrst->crc_clk_src[PERIPH_ID_CSI+1]; - assert(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT); + BUG_ON(!(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT)); internal_id = periph_id_to_internal_id[periph_id]; - assert(internal_id != -1); + BUG_ON(internal_id == -1); if (internal_id >= PERIPHC_X_FIRST) { internal_id -= PERIPHC_X_FIRST; return &clkrst->crc_clk_src_x[internal_id]; @@ -706,7 +706,7 @@ int get_periph_clock_source(enum periph_id periph_id, int mux, err; err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type); - assert(!err); + BUG_ON(err); for (mux = 0; mux < CLOCK_MAX_MUX; mux++) if (clock_source[type][mux] == parent) @@ -726,7 +726,7 @@ void clock_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable the clock to this peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if ((int)periph_id < (int)PERIPH_ID_VW_FIRST) clk = &clkrst->crc_clk_out_enb[PERIPH_REG(periph_id)]; else if ((int)periph_id < PERIPH_ID_X_FIRST) @@ -749,7 +749,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable reset to the peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if (periph_id < PERIPH_ID_VW_FIRST) reset = &clkrst->crc_rst_dev[PERIPH_REG(periph_id)]; else if ((int)periph_id < PERIPH_ID_X_FIRST) diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c index 81fb1d8..903900f 100644 --- a/arch/arm/mach-tegra/tegra20/clock.c +++ b/arch/arm/mach-tegra/tegra20/clock.c @@ -407,9 +407,9 @@ u32 *get_periph_source_reg(enum periph_id periph_id) (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; enum periphc_internal_id internal_id; - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); internal_id = periph_id_to_internal_id[periph_id]; - assert(internal_id != -1); + BUG_ON(internal_id == -1); return &clkrst->crc_clk_src[internal_id]; } @@ -483,7 +483,7 @@ int get_periph_clock_source(enum periph_id periph_id, int mux, err; err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type); - assert(!err); + BUG_ON(err); for (mux = 0; mux < CLOCK_MAX_MUX; mux++) if (clock_source[type][mux] == parent) @@ -494,8 +494,8 @@ int get_periph_clock_source(enum periph_id periph_id, * which is not in our table. If not, then they are asking for a * source which this peripheral can't access through its mux. */ - assert(type == CLOCK_TYPE_PCXTS); - assert(parent == CLOCK_ID_SFROM32KHZ); + BUG_ON(type != CLOCK_TYPE_PCXTS); + BUG_ON(parent != CLOCK_ID_SFROM32KHZ); if (type == CLOCK_TYPE_PCXTS && parent == CLOCK_ID_SFROM32KHZ) return 4; /* mux value for this clock */ @@ -513,7 +513,7 @@ void clock_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable the clock to this peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); reg = readl(clk); if (enable) reg |= PERIPH_MASK(periph_id); @@ -530,7 +530,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable reset to the peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); reg = readl(reset); if (enable) reg |= PERIPH_MASK(periph_id); diff --git a/arch/arm/mach-tegra/tegra210/clock.c b/arch/arm/mach-tegra/tegra210/clock.c index c8bb946..463e91a 100644 --- a/arch/arm/mach-tegra/tegra210/clock.c +++ b/arch/arm/mach-tegra/tegra210/clock.c @@ -707,9 +707,9 @@ u32 *get_periph_source_reg(enum periph_id periph_id) if (periph_id == PERIPH_ID_CSI) return &clkrst->crc_clk_src[PERIPH_ID_CSI+1]; - assert(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT); + BUG_ON(!(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT)); internal_id = INTERNAL_ID(periph_id_to_internal_id[periph_id]); - assert(internal_id != -1); + BUG_ON(internal_id == -1); if (internal_id < PERIPHC_VW_FIRST) /* L, H, U */ @@ -796,7 +796,7 @@ int get_periph_clock_source(enum periph_id periph_id, int mux, err; err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type); - assert(!err); + BUG_ON(err); for (mux = 0; mux < CLOCK_MAX_MUX; mux++) if (clock_source[type][mux] == parent) @@ -816,7 +816,7 @@ void clock_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable the clock to this peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if ((int)periph_id < (int)PERIPH_ID_VW_FIRST) clk = &clkrst->crc_clk_out_enb[PERIPH_REG(periph_id)]; else if ((int)periph_id < (int)PERIPH_ID_X_FIRST) @@ -842,7 +842,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable reset to the peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if (periph_id < PERIPH_ID_VW_FIRST) reset = &clkrst->crc_rst_dev[PERIPH_REG(periph_id)]; else if ((int)periph_id < (int)PERIPH_ID_X_FIRST) diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index 282f34f..b3ec1de 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -466,9 +466,9 @@ u32 *get_periph_source_reg(enum periph_id periph_id) if (periph_id == PERIPH_ID_CSI) return &clkrst->crc_clk_src[PERIPH_ID_CSI+1]; - assert(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT); + BUG_ON(!(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT)); internal_id = periph_id_to_internal_id[periph_id]; - assert(internal_id != -1); + BUG_ON(internal_id == -1); if (internal_id >= PERIPHC_VW_FIRST) { internal_id -= PERIPHC_VW_FIRST; return &clkrst->crc_clk_src_vw[internal_id]; @@ -540,7 +540,7 @@ int get_periph_clock_source(enum periph_id periph_id, int mux, err; err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type); - assert(!err); + BUG_ON(err); for (mux = 0; mux < CLOCK_MAX_MUX; mux++) if (clock_source[type][mux] == parent) @@ -560,7 +560,7 @@ void clock_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable the clock to this peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if ((int)periph_id < (int)PERIPH_ID_VW_FIRST) clk = &clkrst->crc_clk_out_enb[PERIPH_REG(periph_id)]; else @@ -581,7 +581,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) u32 reg; /* Enable/disable reset to the peripheral */ - assert(clock_periph_id_isvalid(periph_id)); + BUG_ON(!clock_periph_id_isvalid(periph_id)); if (periph_id < PERIPH_ID_VW_FIRST) reset = &clkrst->crc_rst_dev[PERIPH_REG(periph_id)]; else diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 0758448..c8665d7 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -333,7 +333,7 @@ int state_setprop(int node, const char *prop_name, const void *data, int size) struct sandbox_state *state_get_current(void) { - assert(state); + BUG_ON(!state); return state; } @@ -367,7 +367,7 @@ int state_init(void) state->ram_size = CONFIG_SYS_SDRAM_SIZE; state->ram_buf = os_malloc(state->ram_size); - assert(state->ram_buf); + BUG_ON(!state->ram_buf); state_reset_for_test(state); /* diff --git a/arch/x86/cpu/intel_common/mrc.c b/arch/x86/cpu/intel_common/mrc.c index f1a249a..0e0f4f2 100644 --- a/arch/x86/cpu/intel_common/mrc.c +++ b/arch/x86/cpu/intel_common/mrc.c @@ -42,7 +42,7 @@ ulong mrc_common_board_get_usable_ram_top(ulong total_size) } /* If no suitable area was found, return an error. */ - assert(largest); + BUG_ON(!largest); if (!largest || largest->size < (2 << 20)) panic("No available memory found for relocation"); diff --git a/arch/x86/lib/efi/efi.c b/arch/x86/lib/efi/efi.c index b1746fa..d98dac3 100644 --- a/arch/x86/lib/efi/efi.c +++ b/arch/x86/lib/efi/efi.c @@ -55,7 +55,7 @@ ulong board_get_usable_ram_top(ulong total_size) } /* If no suitable area was found, return an error. */ - assert(largest); + BUG_ON(!largest); if (!largest || (largest->num_pages << EFI_PAGE_SHIFT) < (2 << 20)) goto err; diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index e0c49be..400b96b 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -91,7 +91,7 @@ void fsp_continue(u32 status, void *hob_list) { post_code(POST_MRC); - assert(status == 0); + BUG_ON(status); /* The boot loader main function entry */ fsp_init_done(hob_list); @@ -126,7 +126,7 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf) fsp_hdr->cfg_region_off); /* Verify the VPD data region is valid */ - assert(fsp_vpd->sign == VPD_IMAGE_ID); + BUG_ON(fsp_vpd->sign != VPD_IMAGE_ID); fsp_upd = &config_data.fsp_upd; @@ -135,7 +135,7 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf) sizeof(struct upd_region)); /* Verify the UPD data region is valid */ - assert(fsp_upd->terminator == UPD_TERMINATOR); + BUG_ON(fsp_upd->terminator != UPD_TERMINATOR); #endif memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf)); diff --git a/arch/x86/lib/physmem.c b/arch/x86/lib/physmem.c index c3c709e..6839bae 100644 --- a/arch/x86/lib/physmem.c +++ b/arch/x86/lib/physmem.c @@ -141,8 +141,7 @@ static void x86_phys_memset_page(phys_addr_t map_addr, uintptr_t offset, int c, const uintptr_t window = LARGE_PAGE_SIZE; /* Make sure the window is below U-Boot. */ - assert(window + LARGE_PAGE_SIZE < - gd->relocaddr - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_STACK_SIZE); + BUG_ON(window + LARGE_PAGE_SIZE >= gd->relocaddr - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_STACK_SIZE); /* Map the page into the window and then memset the appropriate part. */ x86_phys_map_page(window, map_addr, 1); memset((void *)(window + offset), c, size); @@ -165,7 +164,7 @@ phys_addr_t arch_phys_memset(phys_addr_t start, int c, phys_size_t size) phys_size_t low_size = min(max_addr + 1 - start, size); void *start_ptr = (void *)(uintptr_t)start; - assert(((phys_addr_t)(uintptr_t)start) == start); + BUG_ON(((phys_addr_t)(uintptr_t)start) != start); memset(start_ptr, c, low_size); start += low_size; size -= low_size; diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c index cf5023c..fde83aa 100644 --- a/board/freescale/qemu-ppce500/qemu-ppce500.c +++ b/board/freescale/qemu-ppce500/qemu-ppce500.c @@ -109,7 +109,7 @@ static int pci_map_region(void *fdt, int pci_node, int range_id, return -1; /* Map virtual memory for range */ - assert(!tlb_map_range(map_addr, addr, size, TLB_MAP_IO)); + BUG_ON(tlb_map_range(map_addr, addr, size, TLB_MAP_IO)); *pmap_addr = map_addr + size; if (pvaddr) @@ -286,15 +286,13 @@ void init_tlbs(void) init_used_tlb_cams(); /* Create a dynamic AS=0 CCSRBAR mapping */ - assert(!tlb_map_range(CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS, - 1024 * 1024, TLB_MAP_IO)); + BUG_ON(tlb_map_range(CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS, 1024 * 1024, TLB_MAP_IO)); /* Create a RAM map that spans all accessible RAM */ setup_ddr_tlbs(ram_size >> 20); /* Create a map for the TLB */ - assert(!tlb_map_range((ulong)get_fdt_virt(), get_fdt_phys(), - 1024 * 1024, TLB_MAP_RAM)); + BUG_ON(tlb_map_range((ulong)get_fdt_virt(), get_fdt_phys(), 1024 * 1024, TLB_MAP_RAM)); } void init_laws(void) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 478bc11..d77e8fd 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -147,7 +147,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt, memdp = efi_dp_from_mem(0, 0, 0); device_path = image_path = memdp; } else { - assert(device_path && image_path); + BUG_ON(!(device_path && image_path)); } /* Initialize and populate EFI object list */ diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index 3275eb9..d1d358d 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -852,7 +852,7 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_ debug("===device_parse===\n"); - assert(retdev); + BUG_ON(!retdev); *retdev = NULL; if (ret) diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index 37ad2ff..f9fc558 100644 --- a/cmd/tpm_test.c +++ b/cmd/tpm_test.c @@ -180,13 +180,13 @@ static int test_fast_enable(void) TPM_CHECK(tpm_get_flags(&disable, &deactivated, NULL)); printf("\tdisable is %d, deactivated is %d\n", disable, deactivated); - assert(disable == 1 && deactivated == 1); + BUG_ON(!(disable == 1 && deactivated == 1)); TPM_CHECK(tpm_physical_enable()); TPM_CHECK(tpm_physical_set_deactivated(0)); TPM_CHECK(tpm_get_flags(&disable, &deactivated, NULL)); printf("\tdisable is %d, deactivated is %d\n", disable, deactivated); - assert(disable == 0 && deactivated == 0); + BUG_ON(!(disable == 0 && deactivated == 0)); } printf("\tdone\n"); return 0; @@ -213,22 +213,22 @@ static int test_global_lock(void) /* Verifies that write to index0 fails */ x = 1; result = tpm_nv_write_value(INDEX0, (uint8_t *)&x, sizeof(x)); - assert(result == TPM_AREA_LOCKED); + BUG_ON(result != TPM_AREA_LOCKED); TPM_CHECK(tpm_nv_read_value(INDEX0, (uint8_t *)&x, sizeof(x))); - assert(x == 0); + BUG_ON(x); /* Verifies that write to index1 is still possible */ x = 2; TPM_CHECK(tpm_nv_write_value(INDEX1, (uint8_t *)&x, sizeof(x))); TPM_CHECK(tpm_nv_read_value(INDEX1, (uint8_t *)&x, sizeof(x))); - assert(x == 2); + BUG_ON(x != 2); /* Turns off PP */ tpm_tsc_physical_presence(PHYS_PRESENCE); /* Verifies that write to index1 fails */ x = 3; result = tpm_nv_write_value(INDEX1, (uint8_t *)&x, sizeof(x)); - assert(result == TPM_BAD_PRESENCE); + BUG_ON(result != TPM_BAD_PRESENCE); TPM_CHECK(tpm_nv_read_value(INDEX1, (uint8_t *)&x, sizeof(x))); - assert(x == 2); + BUG_ON(x != 2); printf("\tdone\n"); return 0; } @@ -325,7 +325,7 @@ static int test_redefine_unowned(void) TPM_CHECK(TlclStartupIfNeeded()); TPM_CHECK(tpm_self_test_full()); TPM_CHECK(tpm_tsc_physical_presence(PRESENCE)); - assert(!tpm_is_owned()); + BUG_ON(tpm_is_owned()); /* Ensures spaces exist. */ TPM_CHECK(tpm_nv_read_value(INDEX0, (uint8_t *)&x, sizeof(x))); @@ -344,7 +344,7 @@ static int test_redefine_unowned(void) /* Verifies that index0 cannot be redefined */ result = tpm_nv_define_space(INDEX0, perm, sizeof(uint32_t)); - assert(result == TPM_AREA_LOCKED); + BUG_ON(result != TPM_AREA_LOCKED); /* Checks that index1 can */ TPM_CHECK(tpm_nv_define_space(INDEX1, perm, 2 * sizeof(uint32_t))); @@ -355,9 +355,9 @@ static int test_redefine_unowned(void) /* Verifies that neither index0 nor index1 can be redefined */ result = tpm_nv_define_space(INDEX0, perm, sizeof(uint32_t)); - assert(result == TPM_BAD_PRESENCE); + BUG_ON(result != TPM_BAD_PRESENCE); result = tpm_nv_define_space(INDEX1, perm, sizeof(uint32_t)); - assert(result == TPM_BAD_PRESENCE); + BUG_ON(result != TPM_BAD_PRESENCE); printf("done\n"); return 0; @@ -376,9 +376,9 @@ static int test_space_perm(void) TPM_CHECK(tpm_continue_self_test()); TPM_CHECK(tpm_tsc_physical_presence(PRESENCE)); TPM_CHECK(tpm_get_permissions(INDEX0, &perm)); - assert((perm & PERMPPGL) == PERMPPGL); + BUG_ON((perm & PERMPPGL) != PERMPPGL); TPM_CHECK(tpm_get_permissions(INDEX1, &perm)); - assert((perm & PERMPP) == PERMPP); + BUG_ON((perm & PERMPP) != PERMPP); printf("done\n"); return 0; } @@ -469,7 +469,7 @@ static int test_write_limit(void) case TPM_SUCCESS: break; case TPM_MAXNVWRITES: - assert(i >= TPM_MAX_NV_WRITES_NOOWNER); + BUG_ON(TPM_MAX_NV_WRITES_NOOWNER > i); default: pr_err("\tunexpected error code %d (0x%x)\n", result, result); diff --git a/common/dlmalloc.c b/common/dlmalloc.c index b395eef..32ef892 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -57,7 +57,7 @@ GmListElement* makeGmListElement (void* bas) { GmListElement* this; this = (GmListElement*)(void*)LocalAlloc (0, sizeof (GmListElement)); - assert (this); + BUG_ON(!this); if (this) { this->base = bas; @@ -70,19 +70,19 @@ GmListElement* makeGmListElement (void* bas) void gcleanup () { BOOL rval; - assert ( (head == NULL) || (head->base == (void*)gAddressBase)); + BUG_ON(!((head == NULL) || (head->base == (void *)gAddressBase))); if (gAddressBase && (gNextAddress - gAddressBase)) { rval = VirtualFree ((void*)gAddressBase, gNextAddress - gAddressBase, MEM_DECOMMIT); - assert (rval); + BUG_ON(!rval); } while (head) { GmListElement* next = head->next; rval = VirtualFree (head->base, 0, MEM_RELEASE); - assert (rval); + BUG_ON(!rval); LocalFree (head); head = next; } @@ -161,7 +161,7 @@ gAllocatedSize)) } while (gAddressBase == 0); - assert (new_address == (void*)gAddressBase); + BUG_ON(new_address != (void *)gAddressBase); gAllocatedSize = new_size; @@ -734,14 +734,14 @@ static void do_check_chunk(p) mchunkptr p; INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; /* No checkable chunk is mmapped */ - assert(!chunk_is_mmapped(p)); + BUG_ON(chunk_is_mmapped(p)); /* Check for legal address ... */ - assert((char*)p >= sbrk_base); + BUG_ON(sbrk_base > (char *)p); if (p != top) - assert((char*)p + sz <= (char*)top); + BUG_ON((char *)p + sz > (char *)top); else - assert((char*)p + sz <= sbrk_base + sbrked_mem); + BUG_ON((char *)p + sz > sbrk_base + sbrked_mem); } @@ -758,25 +758,25 @@ static void do_check_free_chunk(p) mchunkptr p; do_check_chunk(p); /* Check whether it claims to be free ... */ - assert(!inuse(p)); + BUG_ON(inuse(p)); /* Unless a special marker, must have OK fields */ if ((long)sz >= (long)MINSIZE) { - assert((sz & MALLOC_ALIGN_MASK) == 0); - assert(aligned_OK(chunk2mem(p))); + BUG_ON((sz & MALLOC_ALIGN_MASK)); + BUG_ON(!aligned_OK(chunk2mem(p))); /* ... matching footer field */ - assert(next->prev_size == sz); + BUG_ON(next->prev_size != sz); /* ... and is fully consolidated */ - assert(prev_inuse(p)); - assert (next == top || inuse(next)); + BUG_ON(!prev_inuse(p)); + BUG_ON(!(next == top || inuse(next))); /* ... and has minimally sane links */ - assert(p->fd->bk == p); - assert(p->bk->fd == p); + BUG_ON(p->fd->bk != p); + BUG_ON(p->bk->fd != p); } else /* markers are always of size SIZE_SZ */ - assert(sz == SIZE_SZ); + BUG_ON(sz != SIZE_SZ); } #if __STD_C @@ -789,7 +789,7 @@ static void do_check_inuse_chunk(p) mchunkptr p; do_check_chunk(p); /* Check whether it claims to be in use ... */ - assert(inuse(p)); + BUG_ON(!inuse(p)); /* ... and is surrounded by OK chunks. Since more things can be checked with free chunks than inuse ones, @@ -798,13 +798,13 @@ static void do_check_inuse_chunk(p) mchunkptr p; if (!prev_inuse(p)) { mchunkptr prv = prev_chunk(p); - assert(next_chunk(prv) == p); + BUG_ON(next_chunk(prv) != p); do_check_free_chunk(prv); } if (next == top) { - assert(prev_inuse(next)); - assert(chunksize(next) >= MINSIZE); + BUG_ON(!prev_inuse(next)); + BUG_ON(MINSIZE > chunksize(next)); } else if (!inuse(next)) do_check_free_chunk(next); @@ -823,17 +823,17 @@ static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s; do_check_inuse_chunk(p); /* Legal size ... */ - assert((long)sz >= (long)MINSIZE); - assert((sz & MALLOC_ALIGN_MASK) == 0); - assert(room >= 0); - assert(room < (long)MINSIZE); + BUG_ON((long)MINSIZE > (long)sz); + BUG_ON((sz & MALLOC_ALIGN_MASK)); + BUG_ON(0 > room); + BUG_ON(room >= (long)MINSIZE); /* ... and alignment */ - assert(aligned_OK(chunk2mem(p))); + BUG_ON(!aligned_OK(chunk2mem(p))); /* ... and was allocated at front of an available chunk */ - assert(prev_inuse(p)); + BUG_ON(!prev_inuse(p)); } @@ -966,7 +966,7 @@ static mchunkptr mmap_chunk(size) size_t size; if (n_mmaps > max_n_mmaps) max_n_mmaps = n_mmaps; /* We demand that eight bytes into a page must be 8-byte aligned. */ - assert(aligned_OK(chunk2mem(p))); + BUG_ON(!aligned_OK(chunk2mem(p))); /* The offset to the start of the mmapped region is stored * in the prev_size field of the chunk; normally it is zero, @@ -992,10 +992,10 @@ static void munmap_chunk(p) mchunkptr p; INTERNAL_SIZE_T size = chunksize(p); int ret; - assert (chunk_is_mmapped(p)); - assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); - assert((n_mmaps > 0)); - assert(((p->prev_size + size) & (malloc_getpagesize-1)) == 0); + BUG_ON(!chunk_is_mmapped(p)); + BUG_ON(((char *)p >= sbrk_base && (char *)p < sbrk_base + sbrked_mem)); + BUG_ON(0 >= n_mmaps); + BUG_ON(((p->prev_size + size) & (malloc_getpagesize - 1))); n_mmaps--; mmapped_mem -= (size + p->prev_size); @@ -1003,7 +1003,7 @@ static void munmap_chunk(p) mchunkptr p; ret = munmap((char *)p - p->prev_size, size + p->prev_size); /* munmap returns non-zero on failure */ - assert(ret == 0); + BUG_ON(ret); } #if HAVE_MREMAP @@ -1019,10 +1019,10 @@ static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size; INTERNAL_SIZE_T size = chunksize(p); char *cp; - assert (chunk_is_mmapped(p)); - assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); - assert((n_mmaps > 0)); - assert(((size + offset) & (malloc_getpagesize-1)) == 0); + BUG_ON(!chunk_is_mmapped(p)); + BUG_ON(((char *)p >= sbrk_base && (char *)p < sbrk_base + sbrked_mem)); + BUG_ON(0 >= n_mmaps); + BUG_ON(((size + offset) & (malloc_getpagesize - 1))); /* Note the extra SIZE_SZ overhead as in mmap_chunk(). */ new_size = (new_size + offset + SIZE_SZ + page_mask) & ~page_mask; @@ -1033,9 +1033,9 @@ static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size; p = (mchunkptr)(cp + offset); - assert(aligned_OK(chunk2mem(p))); + BUG_ON(!aligned_OK(chunk2mem(p))); - assert((p->prev_size == offset)); + BUG_ON(p->prev_size != offset); set_head(p, (new_size - offset)|IS_MMAPPED); mmapped_mem -= size + offset; @@ -1165,7 +1165,7 @@ static void malloc_extend_top(nb) INTERNAL_SIZE_T nb; max_total_mem = mmapped_mem + sbrked_mem; /* We always land on a page boundary */ - assert(((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0); + BUG_ON(((unsigned long)((char *)top + top_size) & (pagesz - 1))); } @@ -1991,7 +1991,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; fREe(chunk2mem(p)); p = newp; - assert (newsize >= nb && (((unsigned long)(chunk2mem(p))) % alignment) == 0); + BUG_ON(!(newsize >= nb && (((unsigned long)(chunk2mem(p))) % alignment) == 0)); } /* Also give back spare room at the end */ @@ -2380,7 +2380,7 @@ int mALLOPt(param_number, value) int param_number; int value; int initf_malloc(void) { #if CONFIG_VAL(SYS_MALLOC_F_LEN) - assert(gd->malloc_base); /* Set up by crt0.S */ + BUG_ON(!gd->malloc_base); /* Set up by crt0.S */ gd->malloc_limit = CONFIG_VAL(SYS_MALLOC_F_LEN); gd->malloc_ptr = 0; #endif diff --git a/common/fdt_support.c b/common/fdt_support.c index 6896dcb..6a25844 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1107,7 +1107,7 @@ static struct of_bus *of_match_bus(const void *blob, int parentoffset) * in the of_busses array or something equally catastrophic has * gone wrong. */ - assert(0); + BUG(); return NULL; } diff --git a/common/hwconfig.c b/common/hwconfig.c index e5186d7..fe42a95 100644 --- a/common/hwconfig.c +++ b/common/hwconfig.c @@ -248,37 +248,37 @@ int main() ret = hwconfig_arg("key1", &len); printf("%zd %.*s\n", len, (int)len, ret); - assert(len == 29); - assert(hwconfig_arg_cmp("key1", "subkey1=value1,subkey2=value2")); - assert(!strncmp(ret, "subkey1=value1,subkey2=value2", len)); + BUG_ON(len != 29); + BUG_ON(!hwconfig_arg_cmp("key1", "subkey1=value1,subkey2=value2")); + BUG_ON(strncmp(ret, "subkey1=value1,subkey2=value2", len)); ret = hwconfig_subarg("key1", "subkey1", &len); printf("%zd %.*s\n", len, (int)len, ret); - assert(len == 6); - assert(hwconfig_subarg_cmp("key1", "subkey1", "value1")); - assert(!strncmp(ret, "value1", len)); + BUG_ON(len != 6); + BUG_ON(!hwconfig_subarg_cmp("key1", "subkey1", "value1")); + BUG_ON(strncmp(ret, "value1", len)); ret = hwconfig_subarg("key1", "subkey2", &len); printf("%zd %.*s\n", len, (int)len, ret); - assert(len == 6); - assert(hwconfig_subarg_cmp("key1", "subkey2", "value2")); - assert(!strncmp(ret, "value2", len)); + BUG_ON(len != 6); + BUG_ON(!hwconfig_subarg_cmp("key1", "subkey2", "value2")); + BUG_ON(strncmp(ret, "value2", len)); ret = hwconfig_arg("key2", &len); printf("%zd %.*s\n", len, (int)len, ret); - assert(len == 6); - assert(hwconfig_arg_cmp("key2", "value3")); - assert(!strncmp(ret, "value3", len)); + BUG_ON(len != 6); + BUG_ON(!hwconfig_arg_cmp("key2", "value3")); + BUG_ON(strncmp(ret, "value3", len)); - assert(hwconfig("key3")); - assert(hwconfig_arg("key4", &len) == NULL); - assert(hwconfig_arg("bogus", &len) == NULL); + BUG_ON(!hwconfig("key3")); + BUG_ON(hwconfig_arg("key4", &len)); + BUG_ON(hwconfig_arg("bogus", &len)); unenv_set("hwconfig"); - assert(hwconfig(NULL) == 0); - assert(hwconfig("") == 0); - assert(hwconfig("key3") == 0); + BUG_ON(hwconfig(NULL)); + BUG_ON(hwconfig("")); + BUG_ON(hwconfig("key3")); return 0; } diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 83ba133..52af798 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -64,7 +64,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk) debug("%s(dev=%p, index=%d, clk=%p)\n", __func__, dev, index, clk); - assert(clk); + BUG_ON(!clk); clk->dev = NULL; ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0, diff --git a/drivers/clk/rockchip/clk_rk3036.c b/drivers/clk/rockchip/clk_rk3036.c index 280ebb9..c719a12 100644 --- a/drivers/clk/rockchip/clk_rk3036.c +++ b/drivers/clk/rockchip/clk_rk3036.c @@ -58,8 +58,7 @@ static int rkclk_set_pll(struct rk3036_cru *cru, enum rk_clk_id clk_id, vco=%u Hz, output=%u Hz\n", pll, div->fbdiv, div->refdiv, div->postdiv1, div->postdiv2, vco_hz, output_hz); - assert(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && - output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ); + BUG_ON(!(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ)); /* use integer mode */ rk_setreg(&pll->con1, 1 << PLL_DSMPD_SHIFT); @@ -100,10 +99,10 @@ static void rkclk_init(struct rk3036_cru *cru) * core hz : apll = 1:1 */ aclk_div = APLL_HZ / CORE_ACLK_HZ - 1; - assert((aclk_div + 1) * CORE_ACLK_HZ == APLL_HZ && aclk_div < 0x7); + BUG_ON(!((aclk_div + 1) * CORE_ACLK_HZ == APLL_HZ && aclk_div < 0x7)); pclk_div = APLL_HZ / CORE_PERI_HZ - 1; - assert((pclk_div + 1) * CORE_PERI_HZ == APLL_HZ && pclk_div < 0xf); + BUG_ON(!((pclk_div + 1) * CORE_PERI_HZ == APLL_HZ && pclk_div < 0xf)); rk_clrsetreg(&cru->cru_clksel_con[0], CORE_CLK_PLL_SEL_MASK | CORE_DIV_CON_MASK, @@ -120,13 +119,13 @@ static void rkclk_init(struct rk3036_cru *cru) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / BUS_ACLK_HZ - 1; - assert((aclk_div + 1) * BUS_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f); + BUG_ON(!((aclk_div + 1) * BUS_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f)); pclk_div = GPLL_HZ / BUS_PCLK_HZ - 1; - assert((pclk_div + 1) * BUS_PCLK_HZ == GPLL_HZ && pclk_div <= 0x7); + BUG_ON(!((pclk_div + 1) * BUS_PCLK_HZ == GPLL_HZ && pclk_div <= 0x7)); hclk_div = GPLL_HZ / BUS_HCLK_HZ - 1; - assert((hclk_div + 1) * BUS_HCLK_HZ == GPLL_HZ && hclk_div <= 0x3); + BUG_ON(!((hclk_div + 1) * BUS_HCLK_HZ == GPLL_HZ && hclk_div <= 0x3)); rk_clrsetreg(&cru->cru_clksel_con[0], BUS_ACLK_PLL_SEL_MASK | BUS_ACLK_DIV_MASK, @@ -143,15 +142,13 @@ static void rkclk_init(struct rk3036_cru *cru) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / PERI_ACLK_HZ - 1; - assert((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = ilog2(PERI_ACLK_HZ / PERI_HCLK_HZ); - assert((1 << hclk_div) * PERI_HCLK_HZ == - PERI_ACLK_HZ && (hclk_div < 0x4)); + BUG_ON(!((1 << hclk_div) * PERI_HCLK_HZ == PERI_ACLK_HZ && (hclk_div < 0x4))); pclk_div = ilog2(PERI_ACLK_HZ / PERI_PCLK_HZ); - assert((1 << pclk_div) * PERI_PCLK_HZ == - PERI_ACLK_HZ && pclk_div < 0x8); + BUG_ON(!((1 << pclk_div) * PERI_PCLK_HZ == PERI_ACLK_HZ && pclk_div < 0x8)); rk_clrsetreg(&cru->cru_clksel_con[10], PERI_PLL_SEL_MASK | PERI_PCLK_DIV_MASK | @@ -251,7 +248,7 @@ static ulong rockchip_mmc_set_clk(struct rk3036_cru *cru, uint clk_general_rate, if (src_clk_div > 128) { src_clk_div = DIV_ROUND_UP(OSC_HZ / 2, freq); - assert(src_clk_div - 1 < 128); + BUG_ON(src_clk_div - 1 >= 128); mux = EMMC_SEL_24M; } else { mux = EMMC_SEL_GPLL; diff --git a/drivers/clk/rockchip/clk_rk3128.c b/drivers/clk/rockchip/clk_rk3128.c index 132d50d..1a0d7fc 100644 --- a/drivers/clk/rockchip/clk_rk3128.c +++ b/drivers/clk/rockchip/clk_rk3128.c @@ -51,8 +51,7 @@ static int rkclk_set_pll(struct rk3128_cru *cru, enum rk_clk_id clk_id, debug("PLL at %p:fd=%d,rd=%d,pd1=%d,pd2=%d,vco=%uHz,output=%uHz\n", pll, div->fbdiv, div->refdiv, div->postdiv1, div->postdiv2, vco_hz, output_hz); - assert(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && - output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ); + BUG_ON(!(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ)); /* use integer mode */ rk_setreg(&pll->con1, 1 << PLL_DSMPD_SHIFT); @@ -162,10 +161,10 @@ static void rkclk_init(struct rk3128_cru *cru) * core hz : apll = 1:1 */ aclk_div = APLL_HZ / CORE_ACLK_HZ - 1; - assert((aclk_div + 1) * CORE_ACLK_HZ == APLL_HZ && aclk_div < 0x7); + BUG_ON(!((aclk_div + 1) * CORE_ACLK_HZ == APLL_HZ && aclk_div < 0x7)); pclk_div = APLL_HZ / CORE_PERI_HZ - 1; - assert((pclk_div + 1) * CORE_PERI_HZ == APLL_HZ && pclk_div < 0xf); + BUG_ON(!((pclk_div + 1) * CORE_PERI_HZ == APLL_HZ && pclk_div < 0xf)); rk_clrsetreg(&cru->cru_clksel_con[0], CORE_CLK_PLL_SEL_MASK | CORE_DIV_CON_MASK, @@ -182,13 +181,13 @@ static void rkclk_init(struct rk3128_cru *cru) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / BUS_ACLK_HZ - 1; - assert((aclk_div + 1) * BUS_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f); + BUG_ON(!((aclk_div + 1) * BUS_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f)); pclk_div = BUS_ACLK_HZ / BUS_PCLK_HZ - 1; - assert((pclk_div + 1) * BUS_PCLK_HZ == BUS_ACLK_HZ && pclk_div <= 0x7); + BUG_ON(!((pclk_div + 1) * BUS_PCLK_HZ == BUS_ACLK_HZ && pclk_div <= 0x7)); hclk_div = BUS_ACLK_HZ / BUS_HCLK_HZ - 1; - assert((hclk_div + 1) * BUS_HCLK_HZ == BUS_ACLK_HZ && hclk_div <= 0x3); + BUG_ON(!((hclk_div + 1) * BUS_HCLK_HZ == BUS_ACLK_HZ && hclk_div <= 0x3)); rk_clrsetreg(&cru->cru_clksel_con[0], BUS_ACLK_PLL_SEL_MASK | BUS_ACLK_DIV_MASK, @@ -205,15 +204,13 @@ static void rkclk_init(struct rk3128_cru *cru) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / PERI_ACLK_HZ - 1; - assert((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = ilog2(PERI_ACLK_HZ / PERI_HCLK_HZ); - assert((1 << hclk_div) * PERI_HCLK_HZ == - PERI_ACLK_HZ && (hclk_div < 0x4)); + BUG_ON(!((1 << hclk_div) * PERI_HCLK_HZ == PERI_ACLK_HZ && (hclk_div < 0x4))); pclk_div = ilog2(PERI_ACLK_HZ / PERI_PCLK_HZ); - assert((1 << pclk_div) * PERI_PCLK_HZ == - PERI_ACLK_HZ && pclk_div < 0x8); + BUG_ON(!((1 << pclk_div) * PERI_PCLK_HZ == PERI_ACLK_HZ && pclk_div < 0x8)); rk_clrsetreg(&cru->cru_clksel_con[10], PERI_PLL_SEL_MASK | PERI_PCLK_DIV_MASK | @@ -372,7 +369,7 @@ static ulong rk3128_peri_set_pclk(struct rk3128_cru *cru, ulong clk_id, uint hz) int src_clk_div; src_clk_div = PERI_ACLK_HZ / hz; - assert(src_clk_div - 1 < 4); + BUG_ON(src_clk_div - 1 >= 4); switch (clk_id) { case PCLK_I2C0: @@ -407,7 +404,7 @@ static ulong rk3128_saradc_set_clk(struct rk3128_cru *cru, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(OSC_HZ, hz) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); rk_clrsetreg(&cru->cru_clksel_con[24], SARADC_DIV_CON_MASK, @@ -422,7 +419,7 @@ static ulong rk3128_vop_set_clk(struct rk3128_cru *cru, ulong clk_id, uint hz) struct pll_div cpll_config = {0}; src_clk_div = GPLL_HZ / hz; - assert(src_clk_div - 1 < 31); + BUG_ON(src_clk_div - 1 >= 31); switch (clk_id) { case ACLK_VIO0: diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c index fca6899..6a34459 100644 --- a/drivers/clk/rockchip/clk_rk3188.c +++ b/drivers/clk/rockchip/clk_rk3188.c @@ -96,9 +96,7 @@ static int rkclk_set_pll(struct rk3188_cru *cru, enum rk_clk_id clk_id, debug("PLL at %x: nf=%d, nr=%d, no=%d, vco=%u Hz, output=%u Hz\n", (uint)pll, div->nf, div->nr, div->no, vco_hz, output_hz); - assert(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && - output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ && - (div->no == 1 || !(div->no % 2))); + BUG_ON(!(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ && (div->no == 1 || !(div->no % 2)))); /* enter reset */ rk_setreg(&pll->con3, 1 << PLL_RESET_SHIFT); @@ -295,7 +293,7 @@ static ulong rockchip_mmc_set_clk(struct rk3188_cru *cru, uint gclk_rate, debug("%s: gclk_rate=%u\n", __func__, gclk_rate); /* mmc clock defaulg div 2 internal, need provide double in cru */ src_clk_div = DIV_ROUND_UP(gclk_rate / 2, freq) - 1; - assert(src_clk_div <= 0x3f); + BUG_ON(src_clk_div > 0x3f); switch (periph) { case HCLK_EMMC: @@ -350,16 +348,16 @@ static ulong rockchip_spi_set_clk(struct rk3188_cru *cru, uint gclk_rate, { int src_clk_div = DIV_ROUND_UP(gclk_rate, freq) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); switch (periph) { case SCLK_SPI0: - assert(src_clk_div <= SPI0_DIV_MASK); + BUG_ON(src_clk_div > SPI0_DIV_MASK); rk_clrsetreg(&cru->cru_clksel_con[25], SPI0_DIV_MASK << SPI0_DIV_SHIFT, src_clk_div << SPI0_DIV_SHIFT); break; case SCLK_SPI1: - assert(src_clk_div <= SPI1_DIV_MASK); + BUG_ON(src_clk_div > SPI1_DIV_MASK); rk_clrsetreg(&cru->cru_clksel_con[25], SPI1_DIV_MASK << SPI1_DIV_SHIFT, src_clk_div << SPI1_DIV_SHIFT); @@ -400,7 +398,7 @@ static void rkclk_init(struct rk3188_cru *cru, struct rk3188_grf *grf, * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = DIV_ROUND_UP(GPLL_HZ, CPU_ACLK_HZ) - 1; - assert((aclk_div + 1) * CPU_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f); + BUG_ON(!((aclk_div + 1) * CPU_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f)); rk_clrsetreg(&cru->cru_clksel_con[0], CPU_ACLK_PLL_MASK << CPU_ACLK_PLL_SHIFT | @@ -409,11 +407,11 @@ static void rkclk_init(struct rk3188_cru *cru, struct rk3188_grf *grf, aclk_div << A9_CPU_DIV_SHIFT); hclk_div = ilog2(CPU_ACLK_HZ / CPU_HCLK_HZ); - assert((1 << hclk_div) * CPU_HCLK_HZ == CPU_ACLK_HZ && hclk_div < 0x3); + BUG_ON(!((1 << hclk_div) * CPU_HCLK_HZ == CPU_ACLK_HZ && hclk_div < 0x3)); pclk_div = ilog2(CPU_ACLK_HZ / CPU_PCLK_HZ); - assert((1 << pclk_div) * CPU_PCLK_HZ == CPU_ACLK_HZ && pclk_div < 0x4); + BUG_ON(!((1 << pclk_div) * CPU_PCLK_HZ == CPU_ACLK_HZ && pclk_div < 0x4)); h2p_div = ilog2(CPU_HCLK_HZ / CPU_H2P_HZ); - assert((1 << h2p_div) * CPU_H2P_HZ == CPU_HCLK_HZ && pclk_div < 0x3); + BUG_ON(!((1 << h2p_div) * CPU_H2P_HZ == CPU_HCLK_HZ && pclk_div < 0x3)); rk_clrsetreg(&cru->cru_clksel_con[1], AHB2APB_DIV_MASK << AHB2APB_DIV_SHIFT | @@ -428,15 +426,13 @@ static void rkclk_init(struct rk3188_cru *cru, struct rk3188_grf *grf, * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / PERI_ACLK_HZ - 1; - assert((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = ilog2(PERI_ACLK_HZ / PERI_HCLK_HZ); - assert((1 << hclk_div) * PERI_HCLK_HZ == - PERI_ACLK_HZ && (hclk_div < 0x4)); + BUG_ON(!((1 << hclk_div) * PERI_HCLK_HZ == PERI_ACLK_HZ && (hclk_div < 0x4))); pclk_div = ilog2(PERI_ACLK_HZ / PERI_PCLK_HZ); - assert((1 << pclk_div) * PERI_PCLK_HZ == - PERI_ACLK_HZ && (pclk_div < 0x4)); + BUG_ON(!((1 << pclk_div) * PERI_PCLK_HZ == PERI_ACLK_HZ && (pclk_div < 0x4))); rk_clrsetreg(&cru->cru_clksel_con[10], PERI_PCLK_DIV_MASK << PERI_PCLK_DIV_SHIFT | diff --git a/drivers/clk/rockchip/clk_rk322x.c b/drivers/clk/rockchip/clk_rk322x.c index ff52b55..300f7f8 100644 --- a/drivers/clk/rockchip/clk_rk322x.c +++ b/drivers/clk/rockchip/clk_rk322x.c @@ -54,8 +54,7 @@ static int rkclk_set_pll(struct rk322x_cru *cru, enum rk_clk_id clk_id, debug("PLL at %p: fb=%d, ref=%d, pst1=%d, pst2=%d, vco=%u Hz, output=%u Hz\n", pll, div->fbdiv, div->refdiv, div->postdiv1, div->postdiv2, vco_hz, output_hz); - assert(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && - output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ); + BUG_ON(!(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ)); /* use integer mode */ rk_setreg(&pll->con1, 1 << PLL_DSMPD_SHIFT); @@ -101,10 +100,10 @@ static void rkclk_init(struct rk322x_cru *cru) * core hz : apll = 1:1 */ aclk_div = APLL_HZ / CORE_ACLK_HZ - 1; - assert((aclk_div + 1) * CORE_ACLK_HZ == APLL_HZ && aclk_div < 0x7); + BUG_ON(!((aclk_div + 1) * CORE_ACLK_HZ == APLL_HZ && aclk_div < 0x7)); pclk_div = APLL_HZ / CORE_PERI_HZ - 1; - assert((pclk_div + 1) * CORE_PERI_HZ == APLL_HZ && pclk_div < 0xf); + BUG_ON(!((pclk_div + 1) * CORE_PERI_HZ == APLL_HZ && pclk_div < 0xf)); rk_clrsetreg(&cru->cru_clksel_con[0], CORE_CLK_PLL_SEL_MASK | CORE_DIV_CON_MASK, @@ -121,13 +120,13 @@ static void rkclk_init(struct rk322x_cru *cru) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / BUS_ACLK_HZ - 1; - assert((aclk_div + 1) * BUS_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f); + BUG_ON(!((aclk_div + 1) * BUS_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f)); pclk_div = BUS_ACLK_HZ / BUS_PCLK_HZ - 1; - assert((pclk_div + 1) * BUS_PCLK_HZ == GPLL_HZ && pclk_div <= 0x7); + BUG_ON(!((pclk_div + 1) * BUS_PCLK_HZ == GPLL_HZ && pclk_div <= 0x7)); hclk_div = BUS_ACLK_HZ / BUS_HCLK_HZ - 1; - assert((hclk_div + 1) * BUS_HCLK_HZ == GPLL_HZ && hclk_div <= 0x3); + BUG_ON(!((hclk_div + 1) * BUS_HCLK_HZ == GPLL_HZ && hclk_div <= 0x3)); rk_clrsetreg(&cru->cru_clksel_con[0], BUS_ACLK_PLL_SEL_MASK | BUS_ACLK_DIV_MASK, @@ -144,15 +143,13 @@ static void rkclk_init(struct rk322x_cru *cru) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / PERI_ACLK_HZ - 1; - assert((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = ilog2(PERI_ACLK_HZ / PERI_HCLK_HZ); - assert((1 << hclk_div) * PERI_HCLK_HZ == - PERI_ACLK_HZ && (hclk_div < 0x4)); + BUG_ON(!((1 << hclk_div) * PERI_HCLK_HZ == PERI_ACLK_HZ && (hclk_div < 0x4))); pclk_div = ilog2(PERI_ACLK_HZ / PERI_PCLK_HZ); - assert((1 << pclk_div) * PERI_PCLK_HZ == - PERI_ACLK_HZ && pclk_div < 0x8); + BUG_ON(!((1 << pclk_div) * PERI_PCLK_HZ == PERI_ACLK_HZ && pclk_div < 0x8)); rk_clrsetreg(&cru->cru_clksel_con[10], PERI_PLL_SEL_MASK | PERI_PCLK_DIV_MASK | @@ -252,7 +249,7 @@ static ulong rockchip_mmc_set_clk(struct rk322x_cru *cru, uint clk_general_rate, if (src_clk_div > 128) { src_clk_div = DIV_ROUND_UP(OSC_HZ / 2, freq); - assert(src_clk_div - 1 < 128); + BUG_ON(src_clk_div - 1 >= 128); mux = EMMC_SEL_24M; } else { mux = EMMC_SEL_GPLL; diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c index ac53239..c97bbc4 100644 --- a/drivers/clk/rockchip/clk_rk3288.c +++ b/drivers/clk/rockchip/clk_rk3288.c @@ -152,9 +152,7 @@ static int rkclk_set_pll(struct rk3288_cru *cru, enum rk_clk_id clk_id, debug("PLL at %x: nf=%d, nr=%d, no=%d, vco=%u Hz, output=%u Hz\n", (uint)pll, div->nf, div->nr, div->no, vco_hz, output_hz); - assert(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && - output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ && - (div->no == 1 || !(div->no % 2))); + BUG_ON(!(vco_hz >= VCO_MIN_HZ && vco_hz <= VCO_MAX_HZ && output_hz >= OUTPUT_MIN_HZ && output_hz <= OUTPUT_MAX_HZ && (div->no == 1 || !(div->no % 2)))); /* enter reset */ rk_setreg(&pll->con3, 1 << PLL_RESET_SHIFT); @@ -374,14 +372,12 @@ static void rkclk_init(struct rk3288_cru *cru, struct rk3288_grf *grf) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / PD_BUS_ACLK_HZ - 1; - assert((aclk_div + 1) * PD_BUS_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PD_BUS_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = PD_BUS_ACLK_HZ / PD_BUS_HCLK_HZ - 1; - assert((hclk_div + 1) * PD_BUS_HCLK_HZ == - PD_BUS_ACLK_HZ && (hclk_div < 0x4) && (hclk_div != 0x2)); + BUG_ON(!((hclk_div + 1) * PD_BUS_HCLK_HZ == PD_BUS_ACLK_HZ && (hclk_div < 0x4) && (hclk_div != 0x2))); pclk_div = PD_BUS_ACLK_HZ / PD_BUS_PCLK_HZ - 1; - assert((pclk_div + 1) * PD_BUS_PCLK_HZ == - PD_BUS_ACLK_HZ && pclk_div < 0x7); + BUG_ON(!((pclk_div + 1) * PD_BUS_PCLK_HZ == PD_BUS_ACLK_HZ && pclk_div < 0x7)); rk_clrsetreg(&cru->cru_clksel_con[1], PD_BUS_PCLK_DIV_MASK | PD_BUS_HCLK_DIV_MASK | @@ -396,15 +392,13 @@ static void rkclk_init(struct rk3288_cru *cru, struct rk3288_grf *grf) * set up dependent divisors for PCLK/HCLK and ACLK clocks. */ aclk_div = GPLL_HZ / PERI_ACLK_HZ - 1; - assert((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PERI_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = ilog2(PERI_ACLK_HZ / PERI_HCLK_HZ); - assert((1 << hclk_div) * PERI_HCLK_HZ == - PERI_ACLK_HZ && (hclk_div < 0x4)); + BUG_ON(!((1 << hclk_div) * PERI_HCLK_HZ == PERI_ACLK_HZ && (hclk_div < 0x4))); pclk_div = ilog2(PERI_ACLK_HZ / PERI_PCLK_HZ); - assert((1 << pclk_div) * PERI_PCLK_HZ == - PERI_ACLK_HZ && (pclk_div < 0x4)); + BUG_ON(!((1 << pclk_div) * PERI_PCLK_HZ == PERI_ACLK_HZ && (pclk_div < 0x4))); rk_clrsetreg(&cru->cru_clksel_con[10], PERI_PCLK_DIV_MASK | PERI_HCLK_DIV_MASK | @@ -542,14 +536,12 @@ static ulong rockchip_mmc_set_clk(struct rk3288_cru *cru, uint gclk_rate, if (src_clk_div > 0x3f) { src_clk_div = DIV_ROUND_UP(OSC_HZ / 2, freq); - assert(src_clk_div < 0x40); + BUG_ON(src_clk_div >= 0x40); mux = EMMC_PLL_SELECT_24MHZ; - assert((int)EMMC_PLL_SELECT_24MHZ == - (int)MMC0_PLL_SELECT_24MHZ); + BUG_ON((int)EMMC_PLL_SELECT_24MHZ != (int)MMC0_PLL_SELECT_24MHZ); } else { mux = EMMC_PLL_SELECT_GENERAL; - assert((int)EMMC_PLL_SELECT_GENERAL == - (int)MMC0_PLL_SELECT_GENERAL); + BUG_ON((int)EMMC_PLL_SELECT_GENERAL != (int)MMC0_PLL_SELECT_GENERAL); } switch (periph) { case HCLK_EMMC: @@ -605,7 +597,7 @@ static ulong rockchip_spi_get_clk(struct rk3288_cru *cru, uint gclk_rate, default: return -EINVAL; } - assert(mux == SPI0_PLL_SELECT_GENERAL); + BUG_ON(mux != SPI0_PLL_SELECT_GENERAL); return DIV_TO_RATE(gclk_rate, div); } @@ -617,7 +609,7 @@ static ulong rockchip_spi_set_clk(struct rk3288_cru *cru, uint gclk_rate, debug("%s: clk_general_rate=%u\n", __func__, gclk_rate); src_clk_div = DIV_ROUND_UP(gclk_rate, freq) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); switch (periph) { case SCLK_SPI0: rk_clrsetreg(&cru->cru_clksel_con[25], @@ -660,7 +652,7 @@ static ulong rockchip_saradc_set_clk(struct rk3288_cru *cru, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(OSC_HZ, hz) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); rk_clrsetreg(&cru->cru_clksel_con[24], CLK_SARADC_DIV_CON_MASK, @@ -766,7 +758,7 @@ static ulong rk3288_clk_set_rate(struct clk *clk, ulong rate) /* vop aclk source clk: cpll */ div = CPLL_HZ / rate; - assert((div - 1 < 64) && (div * rate == CPLL_HZ)); + BUG_ON(!((div - 1 < 64) && (div * rate == CPLL_HZ))); switch (clk->id) { case ACLK_VOP0: diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c index 4d522a7..21a7a88 100644 --- a/drivers/clk/rockchip/clk_rk3328.c +++ b/drivers/clk/rockchip/clk_rk3328.c @@ -239,9 +239,7 @@ static void rkclk_set_pll(struct rk3328_cru *cru, enum rk_clk_id clk_id, postdiv2=%d, vco=%u khz, output=%u khz\n", pll_con, div->fbdiv, div->refdiv, div->postdiv1, div->postdiv2, vco_khz, output_khz); - assert(vco_khz >= VCO_MIN_KHZ && vco_khz <= VCO_MAX_KHZ && - output_khz >= OUTPUT_MIN_KHZ && output_khz <= OUTPUT_MAX_KHZ && - div->fbdiv >= PLL_DIV_MIN && div->fbdiv <= PLL_DIV_MAX); + BUG_ON(!(vco_khz >= VCO_MIN_KHZ && vco_khz <= VCO_MAX_KHZ && output_khz >= OUTPUT_MIN_KHZ && output_khz <= OUTPUT_MAX_KHZ && div->fbdiv >= PLL_DIV_MIN && div->fbdiv <= PLL_DIV_MAX)); /* * When power on or changing PLL setting, @@ -354,7 +352,7 @@ static ulong rk3328_i2c_set_clk(struct rk3328_cru *cru, ulong clk_id, uint hz) int src_clk_div; src_clk_div = GPLL_HZ / hz; - assert(src_clk_div - 1 < 127); + BUG_ON(src_clk_div - 1 >= 127); switch (clk_id) { case SCLK_I2C0: @@ -496,7 +494,7 @@ static ulong rk3328_saradc_set_clk(struct rk3328_cru *cru, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(OSC_HZ, hz) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); rk_clrsetreg(&cru->clksel_con[23], CLK_SARADC_DIV_CON_MASK, diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index bfeef39..e295afb 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -377,7 +377,7 @@ static ulong rk3368_spi_set_clk(struct rk3368_cru *cru, ulong clk_id, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(GPLL_HZ, hz); - assert(src_clk_div < 127); + BUG_ON(src_clk_div >= 127); switch (clk_id) { case SCLK_SPI0 ... SCLK_SPI2: @@ -414,7 +414,7 @@ static ulong rk3368_saradc_set_clk(struct rk3368_cru *cru, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(OSC_HZ, hz) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); rk_clrsetreg(&cru->clksel_con[25], CLK_SARADC_DIV_CON_MASK, diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 2e85ac7..e02342c 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -301,9 +301,7 @@ static void rkclk_set_pll(u32 *pll_con, const struct pll_div *div) "postdiv2=%d, vco=%u khz, output=%u khz\n", pll_con, div->fbdiv, div->refdiv, div->postdiv1, div->postdiv2, vco_khz, output_khz); - assert(vco_khz >= VCO_MIN_KHZ && vco_khz <= VCO_MAX_KHZ && - output_khz >= OUTPUT_MIN_KHZ && output_khz <= OUTPUT_MAX_KHZ && - div->fbdiv >= PLL_DIV_MIN && div->fbdiv <= PLL_DIV_MAX); + BUG_ON(!(vco_khz >= VCO_MIN_KHZ && vco_khz <= VCO_MAX_KHZ && output_khz >= OUTPUT_MIN_KHZ && output_khz <= OUTPUT_MAX_KHZ && div->fbdiv >= PLL_DIV_MIN && div->fbdiv <= PLL_DIV_MAX)); /* * When power on or changing PLL setting, @@ -408,16 +406,13 @@ void rk3399_configure_cpu(struct rk3399_cru *cru, rkclk_set_pll(&cru->apll_l_con[0], apll_l_cfgs[apll_l_freq]); aclkm_div = APLL_HZ / ACLKM_CORE_HZ - 1; - assert((aclkm_div + 1) * ACLKM_CORE_HZ == APLL_HZ && - aclkm_div < 0x1f); + BUG_ON(!((aclkm_div + 1) * ACLKM_CORE_HZ == APLL_HZ && aclkm_div < 0x1f)); pclk_dbg_div = APLL_HZ / PCLK_DBG_HZ - 1; - assert((pclk_dbg_div + 1) * PCLK_DBG_HZ == APLL_HZ && - pclk_dbg_div < 0x1f); + BUG_ON(!((pclk_dbg_div + 1) * PCLK_DBG_HZ == APLL_HZ && pclk_dbg_div < 0x1f)); atclk_div = APLL_HZ / ATCLK_CORE_HZ - 1; - assert((atclk_div + 1) * ATCLK_CORE_HZ == APLL_HZ && - atclk_div < 0x1f); + BUG_ON(!((atclk_div + 1) * ATCLK_CORE_HZ == APLL_HZ && atclk_div < 0x1f)); rk_clrsetreg(&cru->clksel_con[0], ACLKM_CORE_L_DIV_CON_MASK | CLK_CORE_L_PLL_SEL_MASK | @@ -498,7 +493,7 @@ static ulong rk3399_i2c_set_clk(struct rk3399_cru *cru, ulong clk_id, uint hz) /* i2c0,4,8 src clock from ppll, i2c1,2,3,5,6,7 src clock from gpll*/ src_clk_div = GPLL_HZ / hz; - assert(src_clk_div - 1 < 127); + BUG_ON(src_clk_div - 1 >= 127); switch (clk_id) { case SCLK_I2C1: @@ -597,7 +592,7 @@ static ulong rk3399_spi_set_clk(struct rk3399_cru *cru, ulong clk_id, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(GPLL_HZ, hz) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); switch (clk_id) { case SCLK_SPI1 ... SCLK_SPI5: @@ -639,7 +634,7 @@ static ulong rk3399_vop_set_clk(struct rk3399_cru *cru, ulong clk_id, u32 hz) } /* vop aclk source clk: cpll */ div = CPLL_HZ / aclk_vop; - assert(div - 1 < 32); + BUG_ON(div - 1 >= 32); rk_clrsetreg(aclkreg_addr, ACLK_VOP_PLL_SEL_MASK | ACLK_VOP_DIV_CON_MASK, @@ -705,7 +700,7 @@ static ulong rk3399_mmc_set_clk(struct rk3399_cru *cru, if (src_clk_div > 128) { /* use 24MHz source for 400KHz clock */ src_clk_div = DIV_ROUND_UP(OSC_HZ / 2, set_rate); - assert(src_clk_div - 1 < 128); + BUG_ON(src_clk_div - 1 >= 128); rk_clrsetreg(&cru->clksel_con[16], CLK_EMMC_PLL_MASK | CLK_EMMC_DIV_CON_MASK, CLK_EMMC_PLL_SEL_24M << CLK_EMMC_PLL_SHIFT | @@ -720,7 +715,7 @@ static ulong rk3399_mmc_set_clk(struct rk3399_cru *cru, case SCLK_EMMC: /* Select aclk_emmc source from GPLL */ src_clk_div = DIV_ROUND_UP(GPLL_HZ , aclk_emmc); - assert(src_clk_div - 1 < 32); + BUG_ON(src_clk_div - 1 >= 32); rk_clrsetreg(&cru->clksel_con[21], ACLK_EMMC_PLL_SEL_MASK | ACLK_EMMC_DIV_CON_MASK, @@ -729,7 +724,7 @@ static ulong rk3399_mmc_set_clk(struct rk3399_cru *cru, /* Select clk_emmc source from GPLL too */ src_clk_div = DIV_ROUND_UP(GPLL_HZ, set_rate); - assert(src_clk_div - 1 < 128); + BUG_ON(src_clk_div - 1 >= 128); rk_clrsetreg(&cru->clksel_con[22], CLK_EMMC_PLL_MASK | CLK_EMMC_DIV_CON_MASK, @@ -797,7 +792,7 @@ static ulong rk3399_saradc_set_clk(struct rk3399_cru *cru, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(OSC_HZ, hz) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); rk_clrsetreg(&cru->clksel_con[26], CLK_SARADC_DIV_CON_MASK, @@ -945,15 +940,13 @@ static void rkclk_init(struct rk3399_cru *cru) /* configure perihp aclk, hclk, pclk */ aclk_div = GPLL_HZ / PERIHP_ACLK_HZ - 1; - assert((aclk_div + 1) * PERIHP_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PERIHP_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = PERIHP_ACLK_HZ / PERIHP_HCLK_HZ - 1; - assert((hclk_div + 1) * PERIHP_HCLK_HZ == - PERIHP_ACLK_HZ && (hclk_div < 0x4)); + BUG_ON(!((hclk_div + 1) * PERIHP_HCLK_HZ == PERIHP_ACLK_HZ && (hclk_div < 0x4))); pclk_div = PERIHP_ACLK_HZ / PERIHP_PCLK_HZ - 1; - assert((pclk_div + 1) * PERIHP_PCLK_HZ == - PERIHP_ACLK_HZ && (pclk_div < 0x7)); + BUG_ON(!((pclk_div + 1) * PERIHP_PCLK_HZ == PERIHP_ACLK_HZ && (pclk_div < 0x7))); rk_clrsetreg(&cru->clksel_con[14], PCLK_PERIHP_DIV_CON_MASK | HCLK_PERIHP_DIV_CON_MASK | @@ -965,15 +958,13 @@ static void rkclk_init(struct rk3399_cru *cru) /* configure perilp0 aclk, hclk, pclk */ aclk_div = GPLL_HZ / PERILP0_ACLK_HZ - 1; - assert((aclk_div + 1) * PERILP0_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f); + BUG_ON(!((aclk_div + 1) * PERILP0_ACLK_HZ == GPLL_HZ && aclk_div < 0x1f)); hclk_div = PERILP0_ACLK_HZ / PERILP0_HCLK_HZ - 1; - assert((hclk_div + 1) * PERILP0_HCLK_HZ == - PERILP0_ACLK_HZ && (hclk_div < 0x4)); + BUG_ON(!((hclk_div + 1) * PERILP0_HCLK_HZ == PERILP0_ACLK_HZ && (hclk_div < 0x4))); pclk_div = PERILP0_ACLK_HZ / PERILP0_PCLK_HZ - 1; - assert((pclk_div + 1) * PERILP0_PCLK_HZ == - PERILP0_ACLK_HZ && (pclk_div < 0x7)); + BUG_ON(!((pclk_div + 1) * PERILP0_PCLK_HZ == PERILP0_ACLK_HZ && (pclk_div < 0x7))); rk_clrsetreg(&cru->clksel_con[23], PCLK_PERILP0_DIV_CON_MASK | HCLK_PERILP0_DIV_CON_MASK | @@ -985,12 +976,10 @@ static void rkclk_init(struct rk3399_cru *cru) /* perilp1 hclk select gpll as source */ hclk_div = GPLL_HZ / PERILP1_HCLK_HZ - 1; - assert((hclk_div + 1) * PERILP1_HCLK_HZ == - GPLL_HZ && (hclk_div < 0x1f)); + BUG_ON(!((hclk_div + 1) * PERILP1_HCLK_HZ == GPLL_HZ && (hclk_div < 0x1f))); pclk_div = PERILP1_HCLK_HZ / PERILP1_HCLK_HZ - 1; - assert((pclk_div + 1) * PERILP1_HCLK_HZ == - PERILP1_HCLK_HZ && (hclk_div < 0x7)); + BUG_ON(!((pclk_div + 1) * PERILP1_HCLK_HZ == PERILP1_HCLK_HZ && (hclk_div < 0x7))); rk_clrsetreg(&cru->clksel_con[25], PCLK_PERILP1_DIV_CON_MASK | HCLK_PERILP1_DIV_CON_MASK | @@ -1099,7 +1088,7 @@ static ulong rk3399_i2c_set_pmuclk(struct rk3399_pmucru *pmucru, ulong clk_id, int src_clk_div; src_clk_div = PPLL_HZ / hz; - assert(src_clk_div - 1 < 127); + BUG_ON(src_clk_div - 1 >= 127); switch (clk_id) { case SCLK_I2C0_PMU: diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c index a119548..38d7548 100644 --- a/drivers/clk/rockchip/clk_rv1108.c +++ b/drivers/clk/rockchip/clk_rv1108.c @@ -147,7 +147,7 @@ static ulong rv1108_saradc_set_clk(struct rv1108_cru *cru, uint hz) int src_clk_div; src_clk_div = DIV_ROUND_UP(OSC_HZ, hz) - 1; - assert(src_clk_div < 128); + BUG_ON(src_clk_div >= 128); rk_clrsetreg(&cru->clksel_con[22], CLK_SARADC_DIV_CON_MASK, diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 3c6ab42..de96024 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -32,7 +32,7 @@ static int device_chld_unbind(struct udevice *dev) struct udevice *pos, *n; int ret, saved_ret = 0; - assert(dev); + BUG_ON(!dev); list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { ret = device_unbind(pos); @@ -54,7 +54,7 @@ static int device_chld_remove(struct udevice *dev, uint flags) struct udevice *pos, *n; int ret; - assert(dev); + BUG_ON(!dev); list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { ret = device_remove(pos, flags); @@ -80,7 +80,7 @@ int device_unbind(struct udevice *dev) return -EINVAL; drv = dev->driver; - assert(drv); + BUG_ON(!drv); if (drv->unbind) { ret = drv->unbind(dev); @@ -173,7 +173,7 @@ int device_remove(struct udevice *dev, uint flags) return 0; drv = dev->driver; - assert(drv); + BUG_ON(!drv); ret = uclass_pre_remove_device(dev); if (ret) diff --git a/drivers/core/device.c b/drivers/core/device.c index 9a46a7b..df1b6e4 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -307,7 +307,7 @@ int device_probe(struct udevice *dev) return 0; drv = dev->driver; - assert(drv); + BUG_ON(!drv); /* Allocate private data if requested and not reentered */ if (drv->priv_auto_alloc_size && !dev->priv) { diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 0030ab9..e059efe 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -18,7 +18,7 @@ int ofnode_read_u32(ofnode node, const char *propname, u32 *outp) { - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); debug("%s: %s: ", __func__, propname); if (ofnode_is_np(node)) { @@ -42,7 +42,7 @@ int ofnode_read_u32(ofnode node, const char *propname, u32 *outp) int ofnode_read_u32_default(ofnode node, const char *propname, u32 def) { - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); ofnode_read_u32(node, propname, &def); return def; @@ -50,7 +50,7 @@ int ofnode_read_u32_default(ofnode node, const char *propname, u32 def) int ofnode_read_s32_default(ofnode node, const char *propname, s32 def) { - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); ofnode_read_u32(node, propname, (u32 *)&def); return def; @@ -60,7 +60,7 @@ bool ofnode_read_bool(ofnode node, const char *propname) { const void *prop; - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); debug("%s: %s: ", __func__, propname); prop = ofnode_get_property(node, propname, NULL); @@ -75,7 +75,7 @@ const char *ofnode_read_string(ofnode node, const char *propname) const char *str = NULL; int len = -1; - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); debug("%s: %s: ", __func__, propname); if (ofnode_is_np(node)) { @@ -107,7 +107,7 @@ ofnode ofnode_find_subnode(ofnode node, const char *subnode_name) { ofnode subnode; - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); debug("%s: %s: ", __func__, subnode_name); if (ofnode_is_np(node)) { @@ -132,7 +132,7 @@ ofnode ofnode_find_subnode(ofnode node, const char *subnode_name) int ofnode_read_u32_array(ofnode node, const char *propname, u32 *out_values, size_t sz) { - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); debug("%s: %s: ", __func__, propname); if (ofnode_is_np(node)) { @@ -147,7 +147,7 @@ int ofnode_read_u32_array(ofnode node, const char *propname, ofnode ofnode_first_subnode(ofnode node) { - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); if (ofnode_is_np(node)) return np_to_ofnode(node.np->child); @@ -157,7 +157,7 @@ ofnode ofnode_first_subnode(ofnode node) ofnode ofnode_next_subnode(ofnode node) { - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); if (ofnode_is_np(node)) return np_to_ofnode(node.np->sibling); @@ -167,7 +167,7 @@ ofnode ofnode_next_subnode(ofnode node) const char *ofnode_get_name(ofnode node) { - assert(ofnode_valid(node)); + BUG_ON(!ofnode_valid(node)); if (ofnode_is_np(node)) return strrchr(node.np->full_name, '/') + 1; @@ -271,7 +271,7 @@ int ofnode_read_string_count(ofnode node, const char *property) static void ofnode_from_fdtdec_phandle_args(struct fdtdec_phandle_args *in, struct ofnode_phandle_args *out) { - assert(OF_MAX_PHANDLE_ARGS == MAX_PHANDLE_ARGS); + BUG_ON(OF_MAX_PHANDLE_ARGS != MAX_PHANDLE_ARGS); out->node = offset_to_ofnode(in->node); out->args_count = in->args_count; memcpy(out->args, in->args, sizeof(out->args)); @@ -280,7 +280,7 @@ static void ofnode_from_fdtdec_phandle_args(struct fdtdec_phandle_args *in, static void ofnode_from_of_phandle_args(struct of_phandle_args *in, struct ofnode_phandle_args *out) { - assert(OF_MAX_PHANDLE_ARGS == MAX_PHANDLE_ARGS); + BUG_ON(OF_MAX_PHANDLE_ARGS != MAX_PHANDLE_ARGS); out->node = np_to_ofnode(in->np); out->args_count = in->args_count; memcpy(out->args, in->args, sizeof(out->args)); diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index f5e4067..3a47cdc 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -371,7 +371,7 @@ int uclass_get_device_tail(struct udevice *dev, int ret, struct udevice **devp) if (ret) return ret; - assert(dev); + BUG_ON(!dev); ret = device_probe(dev); if (ret) return ret; @@ -569,7 +569,7 @@ int uclass_resolve_seq(struct udevice *dev) int seq; int ret; - assert(dev->seq == -1); + BUG_ON(dev->seq != -1); ret = uclass_find_device_by_seq(dev->uclass->uc_drv->id, dev->req_seq, false, &dup); if (!ret) { diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 9faf335..b3e544a 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -480,7 +480,7 @@ const char *gpio_get_bank_info(struct udevice *dev, int *bit_count) /* Must be called on an active device */ priv = dev_get_uclass_priv(dev); - assert(priv); + BUG_ON(!priv); *bit_count = priv->gpio_count; return priv->bank_name; diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c index 920811a..3143056 100644 --- a/drivers/i2c/i2c-uclass.c +++ b/drivers/i2c/i2c-uclass.c @@ -51,7 +51,7 @@ static int i2c_setup_offset(struct dm_i2c_chip *chip, uint offset, msg->buf = offset_buf; if (!chip->offset_len) return -EADDRNOTAVAIL; - assert(chip->offset_len <= I2C_MAX_OFFSET_LEN); + BUG_ON(chip->offset_len > I2C_MAX_OFFSET_LEN); offset_len = chip->offset_len; while (offset_len--) *offset_buf++ = offset >> (8 * offset_len); diff --git a/drivers/input/input.c b/drivers/input/input.c index 26da3a9..7fb72f0 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -248,7 +248,7 @@ static struct input_key_xlate *process_modifier(struct input_config *config, int i; /* Start with the main table, and see what modifiers change it */ - assert(config->num_tables > 0); + BUG_ON(0 >= config->num_tables); table = &config->table[0]; for (i = 1; i < config->num_tables; i++) { struct input_key_xlate *tab = &config->table[i]; @@ -356,7 +356,7 @@ static int sort_array_by_ordering(int *dest, int count, int *order, if (array_search(order, ocount, temp[i]) == -1) dest[dest_count++] = temp[i]; } - assert(dest_count == count); + BUG_ON(dest_count != count); return same; } diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c index cd5bce3..a30f4c9 100644 --- a/drivers/input/key_matrix.c +++ b/drivers/input/key_matrix.c @@ -184,7 +184,7 @@ int key_matrix_init(struct key_matrix *config, int rows, int cols, config->num_cols = cols; config->key_count = rows * cols; config->ghost_filter = ghost_filter; - assert(config->key_count > 0); + BUG_ON(0 >= config->key_count); return 0; } diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index eefaaa5..7d700c5 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -308,7 +308,7 @@ static int ec_command_inptr(struct cros_ec_dev *dev, uint8_t cmd, debug("%s: len=%d, din=%p\n", __func__, len, din); if (dinp) { /* If we have any data to return, it must be 64bit-aligned */ - assert(len <= 0 || !((uintptr_t)din & 7)); + BUG_ON(!(len <= 0 || !((uintptr_t)din & 7))); *dinp = din; } @@ -338,7 +338,7 @@ static int ec_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version, uint8_t *in_buffer; int len; - assert((din_len == 0) || din); + BUG_ON(!((din_len == 0) || din)); len = ec_command_inptr(dev, cmd, cmd_version, dout, dout_len, &in_buffer, din_len); if (len > 0) { @@ -347,7 +347,7 @@ static int ec_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version, * disregard the result. */ if (din && in_buffer) { - assert(len <= din_len); + BUG_ON(len > din_len); memmove(din, in_buffer, len); } } @@ -756,7 +756,7 @@ static int cros_ec_flash_write_block(struct cros_ec_dev *dev, p->offset = offset; p->size = size; - assert(data && p->size <= EC_FLASH_WRITE_VER0_SIZE); + BUG_ON(!(data && p->size <= EC_FLASH_WRITE_VER0_SIZE)); memcpy(p + 1, data, p->size); ret = ec_command_inptr(dev, EC_CMD_FLASH_WRITE, 0, @@ -787,7 +787,7 @@ static int cros_ec_flash_write_burst_size(struct cros_ec_dev *dev) */ static int cros_ec_data_is_erased(const uint32_t *data, int size) { - assert(!(size & 3)); + BUG_ON((size & 3)); size /= sizeof(uint32_t); for (; size > 0; size -= 4, data++) if (*data != -1U) diff --git a/drivers/misc/cros_ec_i2c.c b/drivers/misc/cros_ec_i2c.c index 6e09340..6e87014 100644 --- a/drivers/misc/cros_ec_i2c.c +++ b/drivers/misc/cros_ec_i2c.c @@ -135,8 +135,8 @@ static int cros_ec_i2c_command(struct udevice *udev, uint8_t cmd, debug("%s: Cannot receive %d bytes\n", __func__, din_len); return -1; } - assert(dout_len >= 0); - assert(dinp); + BUG_ON(0 > dout_len); + BUG_ON(!dinp); i2c_msg[0].addr = chip->chip_addr; i2c_msg[0].len = out_bytes; diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c index c03c9cb..a5251aa 100644 --- a/drivers/mtd/nand/tegra_nand.c +++ b/drivers/mtd/nand/tegra_nand.c @@ -259,7 +259,7 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, /* Emulate NAND_CMD_READOOB */ if (command == NAND_CMD_READOOB) { - assert(mtd->writesize != 0); + BUG_ON(!mtd->writesize); column += mtd->writesize; command = NAND_CMD_READ0; } diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index 1ba6815..28ff86d 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -138,7 +138,7 @@ static int sandbox_sf_probe(struct udevice *dev) if (!pdata->filename) { struct sandbox_state *state = state_get_current(); - assert(bus->seq != -1); + BUG_ON(bus->seq == -1); if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS) spec = state->spi[bus->seq][cs].spec; if (!spec) { @@ -416,7 +416,7 @@ static int sandbox_sf_xfer(struct udevice *dev, unsigned int bitlen, cnt = bytes - pos; debug(" tx: read(%u)\n", cnt); - assert(tx); + BUG_ON(!tx); ret = os_read(sbsf->fd, tx + pos, cnt); if (ret < 0) { puts("sandbox_sf: os_read() failed\n"); diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index c76f582..4572adb 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -591,7 +591,7 @@ static int wait_for_mc(bool booting_mc, u32 *final_reg_gsr) struct mc_ccsr_registers __iomem *mc_ccsr_regs = MC_CCSR_BASE_ADDR; dmb(); - assert(timeout_ms > 0); + BUG_ON(0 >= timeout_ms); for (;;) { udelay(1000); /* throttle polling */ reg_gsr = in_le32(&mc_ccsr_regs->reg_gsr); diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 68e518f..203816a 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -44,7 +44,7 @@ int generic_phy_get_by_index(struct udevice *dev, int index, debug("%s(dev=%p, index=%d, phy=%p)\n", __func__, dev, index, phy); - assert(phy); + BUG_ON(!phy); phy->dev = NULL; ret = dev_read_phandle_with_args(dev, "phys", "#phy-cells", 0, index, &args); diff --git a/drivers/power/tps6586x.c b/drivers/power/tps6586x.c index f50c4d1..12b51b9 100644 --- a/drivers/power/tps6586x.c +++ b/drivers/power/tps6586x.c @@ -151,7 +151,7 @@ int tps6586x_set_pwm_mode(int mask) uchar val; int ret; - assert(tps6586x_dev); + BUG_ON(!tps6586x_dev); ret = tps6586x_read(PFM_MODE); if (ret != -1) { val = (uchar)ret; @@ -172,7 +172,7 @@ int tps6586x_adjust_sm0_sm1(int sm0_target, int sm1_target, int step, int rate, int sm0, sm1; int bad; - assert(tps6586x_dev); + BUG_ON(!tps6586x_dev); /* get current voltage settings */ if (read_voltages(&sm0, &sm1)) { diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c index 89312c5..29d86ba 100644 --- a/drivers/rtc/rtc-uclass.c +++ b/drivers/rtc/rtc-uclass.c @@ -14,7 +14,7 @@ int dm_rtc_get(struct udevice *dev, struct rtc_time *time) { struct rtc_ops *ops = rtc_get_ops(dev); - assert(ops); + BUG_ON(!ops); if (!ops->get) return -ENOSYS; return ops->get(dev, time); @@ -24,7 +24,7 @@ int dm_rtc_set(struct udevice *dev, struct rtc_time *time) { struct rtc_ops *ops = rtc_get_ops(dev); - assert(ops); + BUG_ON(!ops); if (!ops->set) return -ENOSYS; return ops->set(dev, time); @@ -34,7 +34,7 @@ int dm_rtc_reset(struct udevice *dev) { struct rtc_ops *ops = rtc_get_ops(dev); - assert(ops); + BUG_ON(!ops); if (!ops->reset) return -ENOSYS; return ops->reset(dev); @@ -44,7 +44,7 @@ int rtc_read8(struct udevice *dev, unsigned int reg) { struct rtc_ops *ops = rtc_get_ops(dev); - assert(ops); + BUG_ON(!ops); if (!ops->read8) return -ENOSYS; return ops->read8(dev, reg); @@ -54,7 +54,7 @@ int rtc_write8(struct udevice *dev, unsigned int reg, int val) { struct rtc_ops *ops = rtc_get_ops(dev); - assert(ops); + BUG_ON(!ops); if (!ops->write8) return -ENOSYS; return ops->write8(dev, reg, val); diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c index 9dda2db..3ad31c9 100644 --- a/drivers/sound/sound.c +++ b/drivers/sound/sound.c @@ -15,7 +15,7 @@ void sound_create_square_wave(unsigned short *data, int size, uint32_t freq) const int period = freq ? sample / freq : 0; const int half = period / 2; - assert(freq); + BUG_ON(!freq); /* Make sure we don't overflow our buffer */ if (size % 2) diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c index 89490f7..7b1f9f1 100644 --- a/drivers/spi/exynos_spi.c +++ b/drivers/spi/exynos_spi.c @@ -86,7 +86,7 @@ static void spi_request_bytes(struct exynos_spi *regs, int count, int step) writel(0, ®s->swap_cfg); } - assert(count && count < (1 << 16)); + BUG_ON(!(count && count < (1 << 16))); setbits_le32(®s->ch_cfg, SPI_CH_RST); clrbits_le32(®s->ch_cfg, SPI_CH_RST); @@ -183,7 +183,7 @@ static int spi_rx_tx(struct exynos_spi_priv *priv, int todo, * and make sure that we transmit dummy bytes too, to * keep things going. */ - assert(!out_bytes); + BUG_ON(out_bytes); out_bytes = in_bytes; toread = in_bytes; txp = NULL; @@ -355,7 +355,7 @@ static int exynos_spi_xfer(struct udevice *dev, unsigned int bitlen, if ((flags & SPI_XFER_END) && !(priv->mode & SPI_SLAVE)) { spi_cs_deactivate(dev); if (priv->skip_preamble) { - assert(!priv->skip_preamble); + BUG_ON(priv->skip_preamble); debug("Failed to complete premable transaction\n"); ret = -1; } diff --git a/drivers/usb/emul/sandbox_flash.c b/drivers/usb/emul/sandbox_flash.c index 2f84b36..3282bca 100644 --- a/drivers/usb/emul/sandbox_flash.c +++ b/drivers/usb/emul/sandbox_flash.c @@ -222,7 +222,7 @@ static void setup_response(struct sandbox_flash_priv *priv, void *resp, csw->dCSWDataResidue = 0; csw->bCSWStatus = CSWSTATUS_GOOD; - assert(!resp || resp == priv->buff); + BUG_ON(!(!resp || resp == priv->buff)); priv->buff_used = size; } diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 4e40f4b..49ac144 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -211,7 +211,7 @@ static void usb_scan_bus(struct udevice *bus, bool recurse) priv = dev_get_uclass_priv(bus); - assert(recurse); /* TODO: Support non-recusive */ + BUG_ON(!recurse); /* TODO: Support non-recusive */ printf("scanning bus %d for devices... ", bus->seq); debug("\n"); @@ -744,7 +744,7 @@ struct udevice *usb_get_bus(struct udevice *dev) bus = bus->parent; if (!bus) { /* By design this cannot happen */ - assert(bus); + BUG_ON(!bus); debug("USB HUB '%s' does not have a controller\n", dev->name); } diff --git a/drivers/video/stb_truetype.h b/drivers/video/stb_truetype.h index 26e483c..f2a24b4 100644 --- a/drivers/video/stb_truetype.h +++ b/drivers/video/stb_truetype.h @@ -417,7 +417,7 @@ int main(int arg, char **argv) #ifndef STBTT_assert #include - #define STBTT_assert(x) assert(x) + #define STBTT_assert(x) BUG_ON(!x) #endif #ifndef STBTT_strlen diff --git a/fs/ext4/dev.c b/fs/ext4/dev.c index f04fa08..77ddce1 100644 --- a/fs/ext4/dev.c +++ b/fs/ext4/dev.c @@ -38,7 +38,7 @@ static disk_partition_t *part_info; void ext4fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info) { - assert(rbdd->blksz == (1 << rbdd->log2blksz)); + BUG_ON(rbdd->blksz != (1 << rbdd->log2blksz)); ext4fs_blk_desc = rbdd; get_fs()->dev_desc = rbdd; part_info = info; diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index dac9545..4b2ca72 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -431,7 +431,7 @@ uint16_t ext4fs_checksum_update(uint32_t i) crc = ext2fs_crc16(crc, &le32_i, sizeof(le32_i)); crc = ext2fs_crc16(crc, desc, offset); offset += sizeof(desc->bg_checksum); /* skip checksum */ - assert(offset == sizeof(*desc)); + BUG_ON(offset != sizeof(*desc)); if (offset < fs->gdsize) { crc = ext2fs_crc16(crc, (__u8 *)desc + offset, fs->gdsize - offset); diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c index fed6287..40d4547 100644 --- a/fs/ext4/ext4_journal.c +++ b/fs/ext4/ext4_journal.c @@ -191,7 +191,7 @@ int ext4fs_put_metadata(char *metadata_buffer, uint32_t blknr) return -EINVAL; } if (dirty_block_ptr[gd_index]->buf) - assert(dirty_block_ptr[gd_index]->blknr == blknr); + BUG_ON(dirty_block_ptr[gd_index]->blknr != blknr); else dirty_block_ptr[gd_index]->buf = zalloc(fs->blksz); diff --git a/fs/fat/fat.c b/fs/fat/fat.c index d16883f..dca22a5 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -705,7 +705,7 @@ static void fat_itr_child(fat_itr *itr, fat_itr *parent) fsdata *mydata = parent->fsdata; /* for silly macros */ unsigned clustnum = START(parent->dent); - assert(fat_itr_isdir(parent)); + BUG_ON(!fat_itr_isdir(parent)); itr->fsdata = parent->fsdata; if (clustnum > 0) { diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 8b9932a..d81c2dc 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -157,9 +157,7 @@ static inline bool ofnode_is_np(ofnode node) * Check our assumption that flat tree offsets are not used when a * live tree is in use. */ - assert(!ofnode_valid(node) || - (of_live_active() ? _ofnode_to_np(node) - : _ofnode_to_np(node))); + BUG_ON(!(!ofnode_valid(node) || (of_live_active() ? _ofnode_to_np(node) : _ofnode_to_np(node)))); #endif return of_live_active() && ofnode_valid(node); } diff --git a/include/efi_loader.h b/include/efi_loader.h index 1b92edb..8b52385 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -25,7 +25,7 @@ const char *__efi_nesting_dec(void); * Enter the u-boot world from UEFI: */ #define EFI_ENTRY(format, ...) do { \ - assert(__efi_entry_check()); \ + BUG_ON(!__efi_entry_check()); \ debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \ __func__, ##__VA_ARGS__); \ } while(0) @@ -37,7 +37,7 @@ const char *__efi_nesting_dec(void); typeof(ret) _r = ret; \ debug("%sEFI: Exit: %s: %u\n", __efi_nesting_dec(), \ __func__, (u32)((uintptr_t) _r & ~EFI_ERROR_MASK)); \ - assert(__efi_exit_check()); \ + BUG_ON(!__efi_exit_check()); \ _r; \ }) @@ -46,9 +46,9 @@ const char *__efi_nesting_dec(void); */ #define EFI_CALL(exp) ({ \ debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \ - assert(__efi_exit_check()); \ + BUG_ON(!__efi_exit_check()); \ typeof(exp) _r = exp; \ - assert(__efi_entry_check()); \ + BUG_ON(!__efi_entry_check()); \ debug("%sEFI: %lu returned by %s\n", __efi_nesting_dec(), \ (unsigned long)((uintptr_t)_r & ~EFI_ERROR_MASK), #exp); \ _r; \ @@ -59,9 +59,9 @@ const char *__efi_nesting_dec(void); */ #define EFI_CALL_VOID(exp) do { \ debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \ - assert(__efi_exit_check()); \ + BUG_ON(!__efi_exit_check()); \ exp; \ - assert(__efi_entry_check()); \ + BUG_ON(!__efi_entry_check()); \ debug("%sEFI: Return From: %s\n", __efi_nesting_dec(), #exp); \ } while(0) diff --git a/lib/circbuf.c b/lib/circbuf.c index 6ed0516..e18601e 100644 --- a/lib/circbuf.c +++ b/lib/circbuf.c @@ -13,12 +13,12 @@ int buf_init (circbuf_t * buf, unsigned int size) { - assert (buf != NULL); + BUG_ON(!buf); buf->size = 0; buf->totalsize = size; buf->data = (char *) malloc (sizeof (char) * size); - assert (buf->data != NULL); + BUG_ON(!buf->data); buf->top = buf->data; buf->tail = buf->data; @@ -29,8 +29,8 @@ int buf_init (circbuf_t * buf, unsigned int size) int buf_free (circbuf_t * buf) { - assert (buf != NULL); - assert (buf->data != NULL); + BUG_ON(!buf); + BUG_ON(!buf->data); free (buf->data); memset (buf, 0, sizeof (circbuf_t)); @@ -43,8 +43,8 @@ int buf_pop (circbuf_t * buf, char *dest, unsigned int len) unsigned int i; char *p; - assert (buf != NULL); - assert (dest != NULL); + BUG_ON(!buf); + BUG_ON(!dest); p = buf->top; @@ -73,8 +73,8 @@ int buf_push (circbuf_t * buf, const char *src, unsigned int len) unsigned int i; char *p; - assert (buf != NULL); - assert (src != NULL); + BUG_ON(!buf); + BUG_ON(!src); p = buf->tail; diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 743b848..b1b25f2 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -62,7 +62,7 @@ int __efi_entry_check(void) { int ret = entry_count++ == 0; #ifdef CONFIG_ARM - assert(efi_gd); + BUG_ON(!efi_gd); app_gd = gd; gd = efi_gd; #endif diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index f6e368e..fcd2d5f 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -507,7 +507,7 @@ struct efi_device_path *efi_dp_from_eth(void) void *buf, *start; unsigned dpsize = 0; - assert(eth_get_dev()); + BUG_ON(!eth_get_dev()); #ifdef CONFIG_DM_ETH dpsize += dp_size(eth_get_dev()); diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c index 52a4e74..b3b49bb 100644 --- a/lib/efi_loader/efi_file.c +++ b/lib/efi_loader/efi_file.c @@ -249,7 +249,7 @@ static efi_status_t dir_read(struct file_handle *fh, u64 *buffer_size, unsigned int required_size; if (!fh->dirs) { - assert(fh->offset == 0); + BUG_ON(fh->offset); fh->dirs = fs_opendir(fh->path); if (!fh->dirs) return EFI_DEVICE_ERROR; diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index d47759e..94d8435 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -385,7 +385,7 @@ efi_status_t efi_free_pool(void *buffer) alloc = container_of(buffer, struct efi_pool_allocation, data); /* Sanity check, was the supplied address returned by allocate_pool */ - assert(((uintptr_t)alloc & EFI_PAGE_MASK) == 0); + BUG_ON(((uintptr_t)alloc & EFI_PAGE_MASK)); r = efi_free_pages((uintptr_t)alloc, alloc->num_pages); diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 30ec6b9..95c6f1f 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -78,7 +78,7 @@ static const char * const compat_names[COMPAT_COUNT] = { const char *fdtdec_get_compatible(enum fdt_compat_id id) { /* We allow reading of the 'unknown' ID for testing purposes */ - assert(id >= 0 && id < COMPAT_COUNT); + BUG_ON(!(id >= 0 && id < COMPAT_COUNT)); return compat_names[id]; } @@ -378,7 +378,7 @@ int fdtdec_next_alias(const void *blob, const char *name, int node, err; /* snprintf() is not available */ - assert(strlen(name) < MAX_STR_LEN); + BUG_ON(strlen(name) >= MAX_STR_LEN); sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto); node = fdt_path_offset(blob, str); if (node < 0) @@ -505,7 +505,7 @@ int fdtdec_add_aliases_for_id(const void *blob, const char *name, if (j == maxcount) break; - assert(!node_list[i]); + BUG_ON(node_list[i]); node_list[i] = nodes[j++]; if (i >= num_found) num_found = i + 1; @@ -585,7 +585,7 @@ int fdtdec_check_fdt(void) * FDT (prior to console ready) will need to make their own * arrangements and do their own checks. */ - assert(!fdtdec_prepare_fdt()); + BUG_ON(fdtdec_prepare_fdt()); return 0; } diff --git a/lib/membuff.c b/lib/membuff.c index fc37757..4c41624 100644 --- a/lib/membuff.c +++ b/lib/membuff.c @@ -25,7 +25,7 @@ static int membuff_putrawflex(struct membuff *mb, int maxlen, bool update, int len; /* always write to 'mb->head' */ - assert(data && offsetp); + BUG_ON(!(data && offsetp)); *data = &mb->start; *offsetp = mb->head - mb->start; @@ -330,7 +330,7 @@ int membuff_extend_by(struct membuff *mb, int by, int max) char *ptr; /* double the buffer size until it is big enough */ - assert(by >= 0); + BUG_ON(0 > by); for (orig = mb->end - mb->start, size = orig; size < orig + by;) size *= 2; if (max != -1) diff --git a/lib/physmem.c b/lib/physmem.c index f21ac24..463bd09 100644 --- a/lib/physmem.c +++ b/lib/physmem.c @@ -16,7 +16,7 @@ phys_addr_t __weak arch_phys_memset(phys_addr_t s, int c, phys_size_t n) { void *s_ptr = (void *)(uintptr_t)s; - assert(((phys_addr_t)(uintptr_t)s) == s); - assert(((phys_addr_t)(uintptr_t)(s + n)) == s + n); + BUG_ON(((phys_addr_t)(uintptr_t)s) != s); + BUG_ON(((phys_addr_t)(uintptr_t)(s + n)) != s + n); return (phys_addr_t)(uintptr_t)memset(s_ptr, c, n); } diff --git a/lib/qsort.c b/lib/qsort.c index 5709884..f1d2427 100644 --- a/lib/qsort.c +++ b/lib/qsort.c @@ -28,7 +28,7 @@ void qsort(void *base, char tmp; if ((nel > 1) && (width > 0)) { - assert(nel <= ((size_t)(-1)) / width); /* check for overflow */ + BUG_ON(nel > ((size_t)(-1)) / width); /* check for overflow */ wgap = 0; do { wgap = 3 * wgap + 1; diff --git a/lib/slre.c b/lib/slre.c index e26d344..5fa92cf 100644 --- a/lib/slre.c +++ b/lib/slre.c @@ -165,7 +165,7 @@ slre_dump(const struct slre *r, FILE *fp) static void set_jump_offset(struct slre *r, int pc, int offset) { - assert(offset < r->code_size); + BUG_ON(offset >= r->code_size); if (r->code_size - offset > 0xff) r->err_str = "Jump offset is too big"; @@ -507,8 +507,8 @@ match(const struct slre *r, int pc, const char *s, int len, while (res && r->code[pc] != END) { - assert(pc < r->code_size); - assert(pc < (int) (sizeof(r->code) / sizeof(r->code[0]))); + BUG_ON(pc >= r->code_size); + BUG_ON(pc >= (int)(sizeof(r->code) / sizeof(r->code[0]))); switch (r->code[pc]) { case BRANCH: @@ -635,7 +635,7 @@ match(const struct slre *r, int pc, const char *s, int len, break; default: printf("unknown cmd (%d) at %d\n", r->code[pc], pc); - assert(0); + BUG(); break; } } diff --git a/net/eth-uclass.c b/net/eth-uclass.c index d30b04b..9c78b8f 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -42,7 +42,7 @@ static struct eth_uclass_priv *eth_get_uclass_priv(void) struct uclass *uc; uclass_get(UCLASS_ETH, &uc); - assert(uc); + BUG_ON(!uc); return uc->priv; } diff --git a/net/eth_legacy.c b/net/eth_legacy.c index be0cf64..0d7c406 100644 --- a/net/eth_legacy.c +++ b/net/eth_legacy.c @@ -187,7 +187,7 @@ int eth_register(struct eth_device *dev) struct eth_device *d; static int index; - assert(strlen(dev->name) < sizeof(dev->name)); + BUG_ON(strlen(dev->name) >= sizeof(dev->name)); if (!eth_devices) { eth_devices = dev; diff --git a/net/net.c b/net/net.c index 4259c9e..bc69c1d 100644 --- a/net/net.c +++ b/net/net.c @@ -784,7 +784,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport, int pkt_hdr_size; /* make sure the net_tx_packet is initialized (net_init() was called) */ - assert(net_tx_packet != NULL); + BUG_ON(!net_tx_packet); if (net_tx_packet == NULL) return -1; diff --git a/test/command_ut.c b/test/command_ut.c index f76d525..a5360c1 100644 --- a/test/command_ut.c +++ b/test/command_ut.c @@ -19,16 +19,16 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* commands separated by \n */ run_command_list("setenv list 1\n setenv list ${list}1", -1, 0); - assert(!strcmp("11", env_get("list"))); + BUG_ON(strcmp("11", env_get("list"))); /* command followed by \n and nothing else */ run_command_list("setenv list 1${list}\n", -1, 0); - assert(!strcmp("111", env_get("list"))); + BUG_ON(strcmp("111", env_get("list"))); /* a command string with \0 in it. Stuff after \0 should be ignored */ run_command("setenv list", 0); run_command_list(test_cmd, sizeof(test_cmd), 0); - assert(!strcmp("123", env_get("list"))); + BUG_ON(strcmp("123", env_get("list"))); /* * a command list where we limit execution to only the first command @@ -36,26 +36,26 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) */ run_command_list("setenv list 1\n setenv list ${list}2; " "setenv list ${list}3", strlen("setenv list 1"), 0); - assert(!strcmp("1", env_get("list"))); + BUG_ON(strcmp("1", env_get("list"))); - assert(run_command("false", 0) == 1); - assert(run_command("echo", 0) == 0); - assert(run_command_list("false", -1, 0) == 1); - assert(run_command_list("echo", -1, 0) == 0); + BUG_ON(run_command("false", 0) != 1); + BUG_ON(run_command("echo", 0)); + BUG_ON(run_command_list("false", -1, 0) != 1); + BUG_ON(run_command_list("echo", -1, 0)); #ifdef CONFIG_HUSH_PARSER run_command("setenv foo 'setenv black 1\nsetenv adder 2'", 0); run_command("run foo", 0); - assert(env_get("black") != NULL); - assert(!strcmp("1", env_get("black"))); - assert(env_get("adder") != NULL); - assert(!strcmp("2", env_get("adder"))); + BUG_ON(!env_get("black")); + BUG_ON(strcmp("1", env_get("black"))); + BUG_ON(!env_get("adder")); + BUG_ON(strcmp("2", env_get("adder"))); #endif - assert(run_command("", 0) == 0); - assert(run_command(" ", 0) == 0); + BUG_ON(run_command("", 0)); + BUG_ON(run_command(" ", 0)); - assert(run_command("'", 0) == 1); + BUG_ON(run_command("'", 0) != 1); printf("%s: Everything went swimmingly\n", __func__); return 0; diff --git a/test/compression.c b/test/compression.c index be4e04e..bba1806 100644 --- a/test/compression.c +++ b/test/compression.c @@ -156,8 +156,8 @@ static int compress_using_bzip2(void *in, unsigned long in_size, unsigned long *out_size) { /* There is no bzip2 compression in u-boot, so fake it. */ - assert(in_size == strlen(plain)); - assert(memcmp(plain, in, in_size) == 0); + BUG_ON(in_size != strlen(plain)); + BUG_ON(memcmp(plain, in, in_size)); if (bzip2_compressed_size > out_max) return -1; @@ -189,8 +189,8 @@ static int compress_using_lzma(void *in, unsigned long in_size, unsigned long *out_size) { /* There is no lzma compression in u-boot, so fake it. */ - assert(in_size == strlen(plain)); - assert(memcmp(plain, in, in_size) == 0); + BUG_ON(in_size != strlen(plain)); + BUG_ON(memcmp(plain, in, in_size)); if (lzma_compressed_size > out_max) return -1; @@ -221,8 +221,8 @@ static int compress_using_lzo(void *in, unsigned long in_size, unsigned long *out_size) { /* There is no lzo compression in u-boot, so fake it. */ - assert(in_size == strlen(plain)); - assert(memcmp(plain, in, in_size) == 0); + BUG_ON(in_size != strlen(plain)); + BUG_ON(memcmp(plain, in, in_size)); if (lzo_compressed_size > out_max) return -1; @@ -254,8 +254,8 @@ static int compress_using_lz4(void *in, unsigned long in_size, unsigned long *out_size) { /* There is no lz4 compression in u-boot, so fake it. */ - assert(in_size == strlen(plain)); - assert(memcmp(plain, in, in_size) == 0); + BUG_ON(in_size != strlen(plain)); + BUG_ON(memcmp(plain, in, in_size)); if (lz4_compressed_size > out_max) return -1; diff --git a/test/print_ut.c b/test/print_ut.c index a42c554..5fefefe 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -24,56 +24,56 @@ static int do_ut_print(cmd_tbl_t *cmdtp, int flag, int argc, printf("%s: Testing print\n", __func__); snprintf(str, sizeof(str), "testing"); - assert(!strcmp("testing", str)); + BUG_ON(strcmp("testing", str)); snprintf(str, sizeof(str), "testing but too long"); - assert(!strcmp("testing b", str)); + BUG_ON(strcmp("testing b", str)); snprintf(str, 1, "testing none"); - assert(!strcmp("", str)); + BUG_ON(strcmp("", str)); *str = 'x'; snprintf(str, 0, "testing none"); - assert(*str == 'x'); + BUG_ON(*str != 'x'); sprintf(big_str, "_%ls_", L"foo"); - assert(!strcmp("_foo_", big_str)); + BUG_ON(strcmp("_foo_", big_str)); /* Test the banner function */ s = display_options_get_banner(true, str, sizeof(str)); - assert(s == str); - assert(!strcmp("\n\nU-Boo\n\n", s)); + BUG_ON(s != str); + BUG_ON(strcmp("\n\nU-Boo\n\n", s)); s = display_options_get_banner(true, str, 1); - assert(s == str); - assert(!strcmp("", s)); + BUG_ON(s != str); + BUG_ON(strcmp("", s)); s = display_options_get_banner(true, str, 2); - assert(s == str); - assert(!strcmp("\n", s)); + BUG_ON(s != str); + BUG_ON(strcmp("\n", s)); s = display_options_get_banner(false, str, sizeof(str)); - assert(s == str); - assert(!strcmp("U-Boot \n\n", s)); + BUG_ON(s != str); + BUG_ON(strcmp("U-Boot \n\n", s)); /* Give it enough space for some of the version */ big_str_len = strlen(version_string) - 5; s = display_options_get_banner_priv(false, FAKE_BUILD_TAG, big_str, big_str_len); - assert(s == big_str); - assert(!strncmp(version_string, s, big_str_len - 3)); - assert(!strcmp("\n\n", s + big_str_len - 3)); + BUG_ON(s != big_str); + BUG_ON(strncmp(version_string, s, big_str_len - 3)); + BUG_ON(strcmp("\n\n", s + big_str_len - 3)); /* Give it enough space for the version and some of the build tag */ big_str_len = strlen(version_string) + 9 + 20; s = display_options_get_banner_priv(false, FAKE_BUILD_TAG, big_str, big_str_len); - assert(s == big_str); + BUG_ON(s != big_str); len = strlen(version_string); - assert(!strncmp(version_string, s, len)); - assert(!strncmp(", Build: ", s + len, 9)); - assert(!strncmp(FAKE_BUILD_TAG, s + 9 + len, 12)); - assert(!strcmp("\n\n", s + big_str_len - 3)); + BUG_ON(strncmp(version_string, s, len)); + BUG_ON(strncmp(", Build: ", s + len, 9)); + BUG_ON(strncmp(FAKE_BUILD_TAG, s + 9 + len, 12)); + BUG_ON(strcmp("\n\n", s + big_str_len - 3)); printf("%s: Everything went swimmingly\n", __func__); return 0; From patchwork Mon Dec 4 03:37:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 120487 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3947279qgn; Sun, 3 Dec 2017 19:38:54 -0800 (PST) X-Google-Smtp-Source: AGs4zMYpSpu2olBaZku1frUcvkWmUCD7Dc6qAGsE3HhQwiJCxmHfaUDenlFX7HqQFwWD5Mw6Wa0u X-Received: by 10.80.186.193 with SMTP id x59mr29015628ede.256.1512358734449; Sun, 03 Dec 2017 19:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512358734; cv=none; d=google.com; s=arc-20160816; b=ZpQvdI+41MPBe5PMuvvlYINAERgIOOBCpYqm8DT+gYvRsH6GEp8Y+XdgKMdpCq7yqa pN6JUT3C4RNLTagfVelzWb25Zc6FoN2lZ4oQopSvdWzFVUWs5DBzTH9RONF9TSh6nBl6 a6pnrRdGxdPSeCuh9LeIiVaZoOLnvLHfgvXr48TtK9osEJNi9j7VLRSaY6TdR3evnTZj NBbZ4pVowQn5Egbjh0Wb6UgUC7IxTbUstF5oqDziD73bgEnJJR+hNOZm8vhG04UBYs6y uafj0XCoW+d/odYccYKhSBGT7jZwCzdT3ydH8EcryzQxk+z8ssY00JstB869bZmkznGG 2RTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=nWdDy0TVw95Fyyp+CdZ0yLo/Y+cnWMgod2nsGFs6JGc=; b=UUkqSz5DYfA1T85thNpU54u4ycIePXIwAE6LunA0eFijpkFzSzS7HVL2Wm25rfofUR 79qNf1HrxAhme5YpajSq47NfMFHw4PDDVhZNZvbc0L0e1x/+7wanX4V2U4ArS/XzEUyB jU+y15EsHp8IXodLDbFHzxuM0M3jRbuuF4G7KOAtE63y0GLCnWpuVarOAmv0WoVudcAv 6YThWfJPsPxDNfQPtvAsNpYUwPsaQ1TWO3knbTuxnot5FmJpC6V5gq5i6hj3ndZfE1Pq UUQarmNMQyo6ielXIWAFgEwAob6GpaYQPExgR362B9Ed5QknMHyQ0uNP1Va+hz2uxSir Tm+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=p/cslfs4; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id x91si1276159edc.408.2017.12.03.19.38.54; Sun, 03 Dec 2017 19:38:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=p/cslfs4; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 06B50C22051; Mon, 4 Dec 2017 03:38:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 035B8C22035; Mon, 4 Dec 2017 03:38:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5D2BAC21D75; Mon, 4 Dec 2017 03:37:59 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 45609C21D75 for ; Mon, 4 Dec 2017 03:37:58 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id vB43bE4t022247; Mon, 4 Dec 2017 12:37:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com vB43bE4t022247 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1512358641; bh=5YPf8fjbrUVNMbFgu/QnMPDmZXgtRJvOtID7owtuccY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p/cslfs4kxrpuJoEudWhwN0wlwihrtsZyIBquR1oUv+9nQ+sIHZaq8Ud5lpwQJ92Q eyIcJQy8qFv2s2l96liN3E4ORHKB7+wBkc0S4tNQ42xEyi3tGG6Vi8MM+9DYJ8X1Nn 5keSFXkdJkA+MuxwHHER7X8k8gnwSg9CjWJ5BncFdFMyX7sOTOq5A/n5ftaZoZc9v3 PEnOIswtvVk68RKygEMJnpT6YiP6f6ox4XFwBzACg6LG5EnWuUJFqrRwPcKs7aRKOc fE6gF0uMCyQ2ndjnI/EMzm196mGpVSnAx+ogvqkhh6NNIRgtqxhCUhPRjXGVdKf3WT ef6iR9TFcLEVg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 4 Dec 2017 12:37:04 +0900 Message-Id: <1512358624-6309-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> References: <1512358624-6309-1-git-send-email-yamada.masahiro@socionext.com> Cc: Marek Vasut , Tom Rini Subject: [U-Boot] [PATCH v2 5/5] Remove assert() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" No more users of assert() except host tools. Remove. Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- Changes in v2: None include/common.h | 15 --------------- lib/tiny-printf.c | 9 --------- lib/vsprintf.c | 9 --------- 3 files changed, 33 deletions(-) diff --git a/include/common.h b/include/common.h index 6e24545..f035f76 100644 --- a/include/common.h +++ b/include/common.h @@ -76,21 +76,6 @@ typedef volatile unsigned char vu_char; #define warn_non_spl(fmt, args...) \ debug_cond(!_SPL_BUILD, fmt, ##args) -/* - * An assertion is run-time check done in debug mode only. If DEBUG is not - * defined then it is skipped. If DEBUG is defined and the assertion fails, - * then it calls panic*( which may or may not reset/halt U-Boot (see - * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found - * before release, and after release it is hoped that they don't matter. But - * in any case these failing assertions cannot be fixed with a reset (which - * may just do the same assertion again). - */ -void __assert_fail(const char *assertion, const char *file, unsigned line, - const char *function); -#define assert(x) \ - ({ if (!(x) && _DEBUG) \ - __assert_fail(#x, __FILE__, __LINE__, __func__); }) - typedef void (interrupt_handler_t)(void *); #include /* boot information for Linux kernel */ diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 0b04813..d5b6d69 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -381,12 +381,3 @@ int snprintf(char *buf, size_t size, const char *fmt, ...) return ret; } - -void __assert_fail(const char *assertion, const char *file, unsigned line, - const char *function) -{ - /* This will not return */ - printf("%s:%u: %s: Assertion `%s' failed.", file, line, function, - assertion); - hang(); -} diff --git a/lib/vsprintf.c b/lib/vsprintf.c index dd572d2..4208239 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -789,15 +789,6 @@ int vprintf(const char *fmt, va_list args) return i; } - -void __assert_fail(const char *assertion, const char *file, unsigned line, - const char *function) -{ - /* This will not return */ - panic("%s:%u: %s: Assertion `%s' failed.", file, line, function, - assertion); -} - char *simple_itoa(ulong i) { /* 21 digits plus null terminator, good for 64-bit or smaller ints */