Remove assert()
Subsystems (28)
v2 cover Remove assert()
assert() is almost used in the same way as BUG_ON(), except:
- the logic is opposite
- currently, assert() is compiled only when DEBUG is defined
Coccinelle can easily convert assert() to BUG_ON(), but the problem is it would grow the image size.
In v2, I introduced CONFIG_ENABLE_BUG_CHECKS.
This option is 'n' by default, and makes it BUG_ON etc. into no-op.
Masahiro Yamada (5):
Move CONFIG_PANIC_HANG to Kconfig
Enable CONFIG_PANIC_HANG for boards without do_reset() Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default
treewide: convert assert() to BUG_ON()
Remove assert()
README | 10 ---- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 3 + 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/powerpc/cpu/mpc85xx/Kconfig | 37 +++++++++++++ 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 ++++++------ configs/TWR-P1025_defconfig | 1 + configs/UCP1020_SPIFLASH_defconfig | 1 + configs/UCP1020_defconfig | 1 + configs/adp-ae3xx_defconfig | 1 + configs/cl-som-imx7_defconfig | 1 + configs/evb-rk3229_defconfig | 1 + configs/mccmon6_sd_defconfig | 1 + configs/opos6uldev_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 + 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/common.h | 15 ----- 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 -- include/dm/ofnode.h | 4 +- include/efi_loader.h | 12 ++-- include/linux/bug.h | 9 ++- lib/Kconfig | 17 ++++++ 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 +-- lib/tiny-printf.c | 9 --- lib/vsprintf.c | 9 --- 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 +++++++------- 130 files changed, 466 insertions(+), 504 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/5 Move CONFIG_PANIC_HANG to Kconfig
Freescale (NXP) boards have lots of defconfig files per board. I used "imply PANIC_HANG" for them.
---
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(-)
README +0 -10
@@ -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
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +3 -0
@@ -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
arch/powerpc/cpu/mpc85xx/Kconfig +37 -0
@@ -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
configs/TWR-P1025_defconfig +1 -0
@@ -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
configs/UCP1020_SPIFLASH_defconfig +1 -0
@@ -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
configs/UCP1020_defconfig +1 -0
@@ -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
configs/adp-ae3xx_defconfig +1 -0
@@ -39,3 +39,4 @@ CONFIG_DM_SPI=y CONFIG_ATCSPI200_SPI=y CONFIG_TIMER=y CONFIG_ATCPIT100_TIMER=y +CONFIG_PANIC_HANG=y
configs/qemu-ppce500_defconfig +1 -0
@@ -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
configs/tricorder_defconfig +1 -0
@@ -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
configs/tricorder_flash_defconfig +1 -0
@@ -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
configs/uniphier_ld4_sld8_defconfig +1 -0
@@ -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
configs/uniphier_v7_defconfig +1 -0
@@ -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
configs/uniphier_v8_defconfig +1 -0
@@ -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
configs/xpedite517x_defconfig +1 -0
@@ -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
configs/xpedite520x_defconfig +1 -0
@@ -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
configs/xpedite537x_defconfig +1 -0
@@ -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
configs/xpedite550x_defconfig +1 -0
@@ -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
include/configs/B4860QDS.h +0 -1
@@ -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
include/configs/C29XPCIE.h +0 -1
@@ -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
include/configs/MPC8536DS.h +0 -1
@@ -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
include/configs/MPC8544DS.h +0 -1
@@ -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
include/configs/MPC8572DS.h +0 -1
@@ -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
include/configs/P1010RDB.h +0 -1
@@ -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
include/configs/P1023RDB.h +0 -2
@@ -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
include/configs/P2041RDB.h +0 -1
@@ -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
include/configs/T102xQDS.h +0 -1
@@ -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
include/configs/T102xRDB.h +0 -1
@@ -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
include/configs/T1040QDS.h +0 -1
@@ -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
include/configs/T104xRDB.h +0 -1
@@ -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
include/configs/T4240RDB.h +0 -1
@@ -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
include/configs/UCP1020.h +0 -1
@@ -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
include/configs/adp-ae3xx.h +0 -1
@@ -21,7 +21,6 @@#define CONFIG_SKIP_TRUNOFF_WATCHDOG #define CONFIG_CMDLINE_EDITING -#define CONFIG_PANIC_HANG #define CONFIG_ARCH_MAP_SYSMEM
include/configs/corenet_ds.h +0 -1
@@ -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
include/configs/cyrus.h +0 -1
@@ -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
include/configs/ls1012a_common.h +0 -1
@@ -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 <asm/arch/soc.h>
include/configs/ls1088a_common.h +0 -2
@@ -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
include/configs/ls2080a_common.h +0 -2
@@ -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
include/configs/p1_p2_rdb_pc.h +0 -1
@@ -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
include/configs/p1_twr.h +0 -1
@@ -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
include/configs/qemu-ppce500.h +0 -1
@@ -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 */
include/configs/t4qds.h +0 -1
@@ -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
include/configs/tricorder.h +0 -1
@@ -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 */
include/configs/uniphier.h +0 -2
@@ -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 */
include/configs/xpedite517x.h +0 -1
@@ -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 */
include/configs/xpedite520x.h +0 -1
@@ -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 */
include/configs/xpedite537x.h +0 -1
@@ -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 */
include/configs/xpedite550x.h +0 -1
@@ -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 */
include/configs/xtfpga.h +0 -4
@@ -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) */
lib/Kconfig +10 -0
@@ -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
Signature · 1 line
2.7.4
PATCH v2 1/5 Move CONFIG_PANIC_HANG to Kconfig
Quoted 8 lines · Masahiro Yamada
Freescale (NXP) boards have lots of defconfig files per board. I used "imply
PANIC_HANG" for them.Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v2:
- Re-runtools/moveconfig.pybased on commit02907004294d9
Freescape/NXP has multiple configuration for each board, and sometimes multiple boards for each SoC. I am not objecting "imply PANIC_HANG" for all of them.
York
PATCH v2 1/5 Move CONFIG_PANIC_HANG to Kconfig
In reply to Masahiro YamadaQuoted 5 lines · Masahiro Yamada
Freescale (NXP) boards have lots of defconfig files per board. I used "imply
PANIC_HANG" for them.Signed-off-by Masahiro Yamada <[email protected]>Reviewed-by York Sun <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171229/edba048a/attachment.sig>
PATCH v2 2/5 Enable CONFIG_PANIC_HANG for boards without do_reset()
In reply to Masahiro YamadaCalling panic() for these boards causes build error:
undefined reference to `do_reset'
They must compile do_reset(), or define CONFIG_PANIC_HANG.
---
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(+)
configs/cl-som-imx7_defconfig +1 -0
@@ -51,3 +51,4 @@ CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_CI_UDC=y CONFIG_OF_LIBFDT=y +CONFIG_PANIC_HANG=y
configs/evb-rk3229_defconfig +1 -0
@@ -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
configs/mccmon6_sd_defconfig +1 -0
@@ -44,3 +44,4 @@ CONFIG_DM_THERMAL=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_PANIC_HANG=y
configs/opos6uldev_defconfig +1 -0
@@ -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
Signature · 1 line
2.7.4
PATCH v2 2/5 Enable CONFIG_PANIC_HANG for boards without do_reset()
Quoted 8 lines · Masahiro Yamada
Calling
panic()for these boards causes build error:
undefined reference to `do_reset'They must compile
do_reset(), or defineCONFIG_PANIC_HANG.Signed-off-by Masahiro Yamada <[email protected]>---
Quoted 7 lines
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(+)
PATCH v2 3/5 Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default
In reply to Masahiro YamadaBUG() 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.
---
Changes in v2:
- Newly added
include/linux/bug.h | 9 ++++++++- lib/Kconfig | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
include/linux/bug.h +8 -1
@@ -6,17 +6,24 @@#include <linux/compiler.h> #include <linux/printk.h> +#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); \ })
lib/Kconfig +7 -0
@@ -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
Signature · 1 line
2.7.4
PATCH v2 3/5 Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default
Quoted 12 lines · Masahiro Yamada
BUG()andBUG_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_CHECKSto 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 <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>
Quoted 8 lines
---
Changes in v2:
- Newly addedinclude/linux/bug.h | 9 ++++++++- lib/Kconfig | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
PATCH v2 3/5 Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default
In reply to Masahiro YamadaHi,
Quoted 56 lines · On Mon, 4 Dec 2017 12:37:02 +0900 Masahiro Yamada wrote:
BUG()andBUG_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_CHECKSto 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 <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v2:
- Newly addedinclude/linux/bug.h | 9 ++++++++- lib/Kconfig | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-)include/linux/bug.h +8
-1@@ -6,17 +6,24 @@#include <linux/compiler.h> #include <linux/printk.h> +#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); \ })lib/Kconfig +0
-0
lib/Kconfig config USE_TINY_PRINTF · line 50
Quoted 6 lines
lib/Kconfig +3
-0@@ -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
This should be 'default y' IMO to keep the current behaviour for all existing platforms.
Lothar Waßmann
PATCH v2 3/5 Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default
Quoted 60 lines · Lothar Waßmann
Hi,
Quoted 57 lines · On Mon, 4 Dec 2017 12:37:02 +0900 Masahiro Yamada wrote:
BUG()andBUG_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_CHECKSto 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 <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v2:
- Newly addedinclude/linux/bug.h | 9 ++++++++- lib/Kconfig | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-)include/linux/bug.h +8
-1@@ -6,17 +6,24 @@#include <linux/compiler.h> #include <linux/printk.h> +#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); \ })lib/Kconfig +0
-0@@ -45,6 +45,13 @@ config USE_TINY_PRINTF
Quoted 7 lines
lib/Kconfig config USE_TINY_PRINTF · line 50
Quoted 5 lines
lib/Kconfig +3
-0The supported format specifiers are %c, %s, %u/%d and %x. +config ENABLE_BUG_CHECKS + bool "Enable BUG/BUG_ON() checks and WARN_ON() logs" + helpThis should be 'default y' IMO to keep the current behaviour for all existing platforms.
I brought this up to Masahiro privately as I had been testing the series, and with ENABLE_BUG_CHECKS=n we get a warning over in the USB code, which in turn got me thinking harder. We do want to be able to disable this, for space reasons, when needed, but it should default to enabled (even if this increases the overall size).
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171212/3d0ed196/attachment.sig>
PATCH v2 3/5 Introduce CONFIG_ENABLE_BUG_CHECKS to disable BUG{_ON} by default
2017-12-12 22:47 GMT+09:00 Tom Rini <[email protected]>:
Quoted 69 lines · Lothar Waßmann
Quoted 60 lines
Hi,
Quoted 57 lines · On Mon, 4 Dec 2017 12:37:02 +0900 Masahiro Yamada wrote:
BUG()andBUG_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_CHECKSto 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 <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v2:
- Newly addedinclude/linux/bug.h | 9 ++++++++- lib/Kconfig | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-)include/linux/bug.h +8
-1@@ -6,17 +6,24 @@#include <linux/compiler.h> #include <linux/printk.h> +#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); \ })lib/Kconfig +0
-0@@ -45,6 +45,13 @@ config USE_TINY_PRINTFQuoted 7 lines
lib/Kconfig config USE_TINY_PRINTF · line 50
Quoted 5 lines
lib/Kconfig +3
-0The supported format specifiers are %c, %s, %u/%d and %x. +config ENABLE_BUG_CHECKS + bool "Enable BUG/BUG_ON() checks and WARN_ON() logs" + helpThis should be 'default y' IMO to keep the current behaviour for all existing platforms.
Quoted 8 lines
I brought this up to Masahiro privately as I had been testing the series, and with ENABLE_BUG_CHECKS=n we get a warning over in the USB code, which in turn got me thinking harder. We do want to be able to disable this, for space reasons, when needed, but it should default to enabled (even if this increases the overall size).
--
Tom
I will flip the default in v3.
Tom privately mentioned this series would be postponed by the next MW. So, I will do v3 when he is ready to receive it.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH v2 4/5 treewide: convert assert() to BUG_ON()
In reply to Masahiro YamadaWe 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:
// <smpl>
@@@@
-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)
// </smpl>
---
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(-)
arch/arm/mach-exynos/clock.c +2 -2
@@ -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 ;
arch/arm/mach-tegra/clock.c +5 -5
@@ -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) */
arch/arm/mach-tegra/pinmux-common.c +40 -40
206 lines not on this page · raw message
arch/arm/mach-tegra/tegra114/clock.c +5 -5
@@ -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
arch/arm/mach-tegra/tegra124/clock.c +5 -5
@@ -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 )
arch/arm/mach-tegra/tegra20/clock.c +7 -7
@@ -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);
arch/arm/mach-tegra/tegra210/clock.c +5 -5
@@ -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 )
arch/arm/mach-tegra/tegra30/clock.c +5 -5
@@ -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
arch/sandbox/cpu/state.c +2 -2
@@ -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);/*
arch/x86/cpu/intel_common/mrc.c +1 -1
@@ -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" );
arch/x86/lib/efi/efi.c +1 -1
@@ -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;
arch/x86/lib/fsp/fsp_support.c +3 -3
@@ -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 ));
arch/x86/lib/physmem.c +2 -3
@@ -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;
board/freescale/qemu-ppce500/qemu-ppce500.c +3 -5
@@ -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 )
cmd/bootefi.c +1 -1
@@ -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 */
cmd/mtdparts.c +1 -1
@@ -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)
cmd/tpm_test.c +14 -14
@@ -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);
common/dlmalloc.c +43 -43
216 lines not on this page · raw message
common/fdt_support.c +1 -1
@@ -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 ; }
common/hwconfig.c +18 -18
@@ -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 ; }
drivers/clk/clk-uclass.c +1 -1
@@ -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,
drivers/clk/rockchip/clk_rk3036.c +10 -13
@@ -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 ;
drivers/clk/rockchip/clk_rk3128.c +12 -15
@@ -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 :
drivers/clk/rockchip/clk_rk3188.c +12 -16
@@ -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 |
drivers/clk/rockchip/clk_rk322x.c +10 -13
@@ -54,8 +54,7 @@ static int rkclk_set_pll(struct rk322x_cru *cru, enum rk_clk_id clk_id,debug ("PLL@%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 ;
drivers/clk/rockchip/clk_rk3288.c +14 -22
@@ -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 :
drivers/clk/rockchip/clk_rk3328.c +3 -5
@@ -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,
drivers/clk/rockchip/clk_rk3368.c +2 -2
@@ -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,
drivers/clk/rockchip/clk_rk3399.c +20 -31
143 lines not on this page · raw message
drivers/clk/rockchip/clk_rv1108.c +1 -1
@@ -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,
drivers/core/device-remove.c +4 -4
@@ -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)
drivers/core/device.c +1 -1
@@ -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) {
drivers/core/ofnode.c +12 -12
@@ -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));
drivers/core/uclass.c +2 -2
@@ -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) {
drivers/gpio/gpio-uclass.c +1 -1
@@ -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;
drivers/i2c/i2c-uclass.c +1 -1
@@ -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);
drivers/input/input.c +2 -2
@@ -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; }
drivers/input/key_matrix.c +1 -1
@@ -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 ; }
drivers/misc/cros_ec.c +5 -5
@@ -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 )
drivers/misc/cros_ec_i2c.c +2 -2
@@ -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;
drivers/mtd/nand/tegra_nand.c +1 -1
@@ -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 ; }
drivers/mtd/spi/sandbox.c +2 -2
@@ -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" );
drivers/net/fsl-mc/mc.c +1 -1
@@ -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);
drivers/phy/phy-uclass.c +1 -1
@@ -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);
drivers/power/tps6586x.c +2 -2
@@ -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)) {
drivers/rtc/rtc-uclass.c +5 -5
@@ -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);
drivers/sound/sound.c +1 -1
@@ -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 )
drivers/spi/exynos_spi.c +3 -3
@@ -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 ; }
drivers/usb/emul/sandbox_flash.c +1 -1
@@ -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; }
drivers/usb/host/usb-uclass.c +2 -2
@@ -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); }
drivers/video/stb_truetype.h +1 -1
@@ -417,7 +417,7 @@ int main(int arg, char **argv)#ifndef STBTT_assert#include <assert.h> -#define STBTT_assert (x) assert(x) +#define STBTT_assert (x) BUG_ON(!x)#endif #ifndef STBTT_strlen
fs/ext4/dev.c +1 -1
@@ -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;
fs/ext4/ext4_common.c +1 -1
@@ -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);
fs/ext4/ext4_journal.c +1 -1
@@ -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);
fs/fat/fat.c +1 -1
@@ -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 ) {
include/dm/ofnode.h +1 -3
@@ -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); }
include/efi_loader.h +6 -6
@@ -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)
lib/circbuf.c +8 -8
@@ -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;
lib/efi_loader/efi_boottime.c +1 -1
@@ -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
lib/efi_loader/efi_device_path.c +1 -1
@@ -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 ());
lib/efi_loader/efi_file.c +1 -1
@@ -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 ;
lib/efi_loader/efi_memory.c +1 -1
@@ -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);
lib/fdtdec.c +4 -4
@@ -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 ; }
lib/membuff.c +2 -2
@@ -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 )
lib/physmem.c +2 -2
@@ -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); }
lib/qsort.c +1 -1
@@ -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;
lib/slre.c +4 -4
@@ -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 ; } }
net/eth-uclass.c +1 -1
@@ -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; }
net/eth_legacy.c +1 -1
@@ -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;
net/net.c +1 -1
@@ -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 ;
test/command_ut.c +15 -15
@@ -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 ;
test/compression.c +8 -8
@@ -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 ;
test/print_ut.c +21 -21
77 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 5/5 Remove assert()
In reply to Masahiro YamadaNo more users of assert() except host tools. Remove.
---
Changes in v2: None
include/common.h | 15 --------------- lib/tiny-printf.c | 9 --------- lib/vsprintf.c | 9 --------- 3 files changed, 33 deletions(-)
include/common.h +0 -15
@@ -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 <asm/u-boot.h> /* boot information for Linux kernel */
lib/tiny-printf.c +0 -9
@@ -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 (); -}
lib/vsprintf.c +0 -9
@@ -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 */
Signature · 1 line
2.7.4
PATCH v2 5/5 Remove assert()
Quoted 11 lines · Masahiro Yamada
No more users of
assert()except host tools. Remove.Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v2: None
include/common.h | 15 --------------- lib/tiny-printf.c | 9 --------- lib/vsprintf.c | 9 --------- 3 files changed, 33 deletions(-)