mtd: Replace if and BUG with BUG_ON

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Aug 1 18:59:02 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=8bf66b24cfcb71d6f3e33a0ebd119678823d7c70
Commit:     8bf66b24cfcb71d6f3e33a0ebd119678823d7c70
Parent:     b137aab438382fdadfe1272869357485af0252b4
Author:     Amitoj Kaur Chawla <amitoj1606 at gmail.com>
AuthorDate: Sat May 28 22:11:17 2016 +0530
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Sat Jul 9 18:48:54 2016 -0700

    mtd: Replace if and BUG with BUG_ON
    
    Replace if condition and BUG() with a BUG_ON having the conditional
    expression of the if statement as argument.
    
    The Coccinelle semantic patch used to make this change is as follows:
    @@ expression E,f; @@
    
    (
      if (<+... f(...) ...+>) { BUG(); }
    |
    - if (E) { BUG(); }
    + BUG_ON(E);
    )
    
    Signed-off-by: Amitoj Kaur Chawla <amitoj1606 at gmail.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/ssfdc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c
index daf82ba..41b13d1 100644
--- a/drivers/mtd/ssfdc.c
+++ b/drivers/mtd/ssfdc.c
@@ -380,8 +380,7 @@ static int ssfdcr_readsect(struct mtd_blktrans_dev *dev,
 		" block_addr=%d\n", logic_sect_no, sectors_per_block, offset,
 		block_address);
 
-	if (block_address >= ssfdc->map_len)
-		BUG();
+	BUG_ON(block_address >= ssfdc->map_len);
 
 	block_address = ssfdc->logic_block_map[block_address];
 



More information about the linux-mtd-cvs mailing list