mtd: Replace if and BUG with BUG_ON
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Sat, 28 May 2016 16:41:17 +0000 (22:11 +0530)
committerBrian Norris <computersforpeace@gmail.com>
Sun, 10 Jul 2016 01:48:54 +0000 (18:48 -0700)
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@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/ssfdc.c

index daf82ba7aba038ba4ca322921826cf23d748076f..41b13d1cdcc44dede4d5c6b64eb03e322b05a0ff 100644 (file)
@@ -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];