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

BUG_ON() Conversion in drivers/mtd/

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
373ebfbf 36ddf5bb

+7 -10
+4 -4
drivers/mtd/maps/dilnetpc.c
··· 218 218 { 219 219 if(--vpp_counter == 0) 220 220 setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4); 221 - else if(vpp_counter < 0) 222 - BUG(); 221 + else 222 + BUG_ON(vpp_counter < 0); 223 223 } 224 224 spin_unlock_irq(&dnpc_spin); 225 225 } ··· 240 240 { 241 241 if(--vpp_counter == 0) 242 242 setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8); 243 - else if(vpp_counter < 0) 244 - BUG(); 243 + else 244 + BUG_ON(vpp_counter < 0); 245 245 } 246 246 spin_unlock_irq(&dnpc_spin); 247 247 }
+1 -2
drivers/mtd/mtd_blkdevs.c
··· 450 450 451 451 kfree(tr->blkcore_priv); 452 452 453 - if (!list_empty(&tr->devs)) 454 - BUG(); 453 + BUG_ON(!list_empty(&tr->devs)); 455 454 return 0; 456 455 } 457 456
+2 -4
drivers/mtd/mtdconcat.c
··· 477 477 } 478 478 479 479 /* must never happen since size limit has been verified above */ 480 - if (i >= concat->num_subdev) 481 - BUG(); 480 + BUG_ON(i >= concat->num_subdev); 482 481 483 482 /* now do the erase: */ 484 483 err = 0; ··· 499 500 if ((err = concat_dev_erase(subdev, erase))) { 500 501 /* sanity check: should never happen since 501 502 * block alignment has been checked above */ 502 - if (err == -EINVAL) 503 - BUG(); 503 + BUG_ON(err == -EINVAL); 504 504 if (erase->fail_addr != 0xffffffff) 505 505 instr->fail_addr = erase->fail_addr + offset; 506 506 break;