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>
This commit is contained in:
zhouchuangao 2021-04-24 08:59:50 -07:00 committed by Thomas Bogendoerfer
parent c55944cc0e
commit 7e9be673cb

View File

@ -43,8 +43,7 @@ static void bcm63xx_gpio_set(struct gpio_chip *chip,
u32 *v;
unsigned long flags;
if (gpio >= chip->ngpio)
BUG();
BUG_ON(gpio >= chip->ngpio);
if (gpio < 32) {
reg = gpio_out_low_reg;
@ -70,8 +69,7 @@ static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
u32 reg;
u32 mask;
if (gpio >= chip->ngpio)
BUG();
BUG_ON(gpio >= chip->ngpio);
if (gpio < 32) {
reg = gpio_out_low_reg;
@ -92,8 +90,7 @@ static int bcm63xx_gpio_set_direction(struct gpio_chip *chip,
u32 tmp;
unsigned long flags;
if (gpio >= chip->ngpio)
BUG();
BUG_ON(gpio >= chip->ngpio);
if (gpio < 32) {
reg = GPIO_CTL_LO_REG;