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

BUG_ON() Conversion in drivers/char

this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>

authored by

Eric Sesterhenn and committed by
Adrian Bunk
56ee4827 373ebfbf

+5 -9
+1 -2
drivers/char/epca.c
··· 486 486 } /* End channel is open more than once */ 487 487 488 488 /* Port open only once go ahead with shutdown & reset */ 489 - if (ch->count < 0) 490 - BUG(); 489 + BUG_ON(ch->count < 0); 491 490 492 491 /* --------------------------------------------------------------- 493 492 Let the rest of the driver know the channel is being closed.
+4 -7
drivers/char/tty_io.c
··· 543 543 struct tty_ldisc *ld; 544 544 unsigned long flags; 545 545 546 - if (disc < N_TTY || disc >= NR_LDISCS) 547 - BUG(); 546 + BUG_ON(disc < N_TTY || disc >= NR_LDISCS); 548 547 549 548 spin_lock_irqsave(&tty_ldisc_lock, flags); 550 549 ld = &tty_ldiscs[disc]; 551 - if(ld->refcount == 0) 552 - BUG(); 553 - ld->refcount --; 550 + BUG_ON(ld->refcount == 0); 551 + ld->refcount--; 554 552 module_put(ld->owner); 555 553 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 556 554 } ··· 643 645 { 644 646 unsigned long flags; 645 647 646 - if(ld == NULL) 647 - BUG(); 648 + BUG_ON(ld == NULL); 648 649 649 650 spin_lock_irqsave(&tty_ldisc_lock, flags); 650 651 if(ld->refcount == 0)