Skip to content

Commit 7e9be67

Browse files
zhouchuangaotsbogend
authored andcommitted
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 <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent c55944c commit 7e9be67

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

arch/mips/bcm63xx/gpio.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ static void bcm63xx_gpio_set(struct gpio_chip *chip,
4343
u32 *v;
4444
unsigned long flags;
4545

46-
if (gpio >= chip->ngpio)
47-
BUG();
46+
BUG_ON(gpio >= chip->ngpio);
4847

4948
if (gpio < 32) {
5049
reg = gpio_out_low_reg;
@@ -70,8 +69,7 @@ static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
7069
u32 reg;
7170
u32 mask;
7271

73-
if (gpio >= chip->ngpio)
74-
BUG();
72+
BUG_ON(gpio >= chip->ngpio);
7573

7674
if (gpio < 32) {
7775
reg = gpio_out_low_reg;
@@ -92,8 +90,7 @@ static int bcm63xx_gpio_set_direction(struct gpio_chip *chip,
9290
u32 tmp;
9391
unsigned long flags;
9492

95-
if (gpio >= chip->ngpio)
96-
BUG();
93+
BUG_ON(gpio >= chip->ngpio);
9794

9895
if (gpio < 32) {
9996
reg = GPIO_CTL_LO_REG;

0 commit comments

Comments
 (0)