mbox series

[v3,0/6] assert() is almost used in the same way as BUG_ON(), except:

Message ID 1515548724-31869-1-git-send-email-yamada.masahiro@socionext.com
Headers show
Series assert() is almost used in the same way as BUG_ON(), except: | expand

Message

Masahiro Yamada Jan. 10, 2018, 1:45 a.m. UTC
- the logic is opposite
  - currently, assert() is compiled only when DEBUG is defined

Coccinelle can easily convert assert() to BUG_ON().

A problem is it would grow the image size.
In v2, I introduced a new CONFIG option to allow to disable it.

In v3, it is default 'y'.  I disabled it only for openrd boards.


Masahiro Yamada (6):
  Enable CONFIG_PANIC_HANG for boards without do_reset()
  usb: xhci: return ERR_PTR(-ETIMEDOUT) at the end of
    xhci_wait_for_event()
  Introduce CONFIG_BUG_CHECKS to allow to disable BUG{_ON} and WARN_ON
  ARM: openrd: disable CONFIG_BUG_CHECKS
  treewide: convert assert() to BUG_ON()
  Remove assert()

 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 ++++++------
 configs/cl-som-imx7_defconfig               |  1 +
 configs/evb-rk3229_defconfig                |  1 +
 configs/mccmon6_sd_defconfig                |  1 +
 configs/openrd_base_defconfig               |  1 +
 configs/openrd_client_defconfig             |  1 +
 configs/openrd_ultimate_defconfig           |  1 +
 configs/opos6uldev_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/usb/host/xhci-ring.c                |  7 +++
 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 ++--
 include/linux/bug.h                         |  9 ++-
 include/log.h                               | 15 -----
 lib/Kconfig                                 |  9 +++
 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/print_ut.c                             | 42 +++++++-------
 85 files changed, 406 insertions(+), 448 deletions(-)

Comments

Tom Rini Jan. 28, 2018, 4:04 p.m. UTC | #1
On Wed, Jan 10, 2018 at 10:45:18AM +0900, Masahiro Yamada wrote:

>   - the logic is opposite

>   - currently, assert() is compiled only when DEBUG is defined

> 

> Coccinelle can easily convert assert() to BUG_ON().

> 

> A problem is it would grow the image size.

> In v2, I introduced a new CONFIG option to allow to disable it.

> 

> In v3, it is default 'y'.  I disabled it only for openrd boards.

> 

> 

> Masahiro Yamada (6):

>   Enable CONFIG_PANIC_HANG for boards without do_reset()

>   usb: xhci: return ERR_PTR(-ETIMEDOUT) at the end of

>     xhci_wait_for_event()

>   Introduce CONFIG_BUG_CHECKS to allow to disable BUG{_ON} and WARN_ON

>   ARM: openrd: disable CONFIG_BUG_CHECKS

>   treewide: convert assert() to BUG_ON()

>   Remove assert()


So, as much as I want this change in theory, I'm not sure what to do
with this series.  First, there's the USB side (and other I'm sure less
visible cases) where this does change behavior a bit.  But second, and
harder to deal with, is that this totally breaks all of our test/py code
(make tests hangs) and I haven't come up with a good fix.  I think some
of these changes can certainly be brought in.

-- 
Tom