]> Git Repo - linux.git/commitdiff
MIPS: BCM63XX: Use BUG_ON instead of condition followed by BUG.
authorzhouchuangao <[email protected]>
Sat, 24 Apr 2021 15:59:50 +0000 (08:59 -0700)
committerThomas Bogendoerfer <[email protected]>
Mon, 26 Apr 2021 08:23:52 +0000 (10:23 +0200)
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 <[email protected]>
Acked-by: Florian Fainelli <[email protected]>
Signed-off-by: Thomas Bogendoerfer <[email protected]>
arch/mips/bcm63xx/gpio.c

index 16f353ac3441f54b4e8384dabeeb206ce49380a2..5c4a233db55ff9c2e755aa45fa7c071b69e85232 100644 (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;
This page took 0.057635 seconds and 4 git commands to generate.