Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: BCM63XX: Use BUG_ON instead of condition followed by BUG.

BUG_ON uses unlikely in if(), it can be optimized at compile time.

Usually, the condition in if() is not satisfied. In my opinion,
this can improve the efficiency of the multi-stage pipeline.

Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

zhouchuangao and committed by
Thomas Bogendoerfer
7e9be673 c55944cc

+3 -6
+3 -6
arch/mips/bcm63xx/gpio.c
··· 43 43 u32 *v; 44 44 unsigned long flags; 45 45 46 - if (gpio >= chip->ngpio) 47 - BUG(); 46 + BUG_ON(gpio >= chip->ngpio); 48 47 49 48 if (gpio < 32) { 50 49 reg = gpio_out_low_reg; ··· 69 70 u32 reg; 70 71 u32 mask; 71 72 72 - if (gpio >= chip->ngpio) 73 - BUG(); 73 + BUG_ON(gpio >= chip->ngpio); 74 74 75 75 if (gpio < 32) { 76 76 reg = gpio_out_low_reg; ··· 90 92 u32 tmp; 91 93 unsigned long flags; 92 94 93 - if (gpio >= chip->ngpio) 94 - BUG(); 95 + BUG_ON(gpio >= chip->ngpio); 95 96 96 97 if (gpio < 32) { 97 98 reg = GPIO_CTL_LO_REG;