BUG_ON() Conversion in drivers/mtd/
authorEric Sesterhenn <snakebyte@gmx.de>
Sun, 26 Mar 2006 16:15:12 +0000 (18:15 +0200)
committerAdrian Bunk <bunk@stusta.de>
Sun, 26 Mar 2006 16:15:12 +0000 (18:15 +0200)
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>
drivers/mtd/maps/dilnetpc.c
drivers/mtd/mtd_blkdevs.c
drivers/mtd/mtdconcat.c

index b51c757817d819c3cc4352ed773df591a905222d..efb221692641e6ff0ae03ab444cc1d4803ef73e5 100644 (file)
@@ -218,8 +218,8 @@ static void dnp_set_vpp(struct map_info *not_used, int on)
        {
                if(--vpp_counter == 0)
                        setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4);
-               else if(vpp_counter < 0)
-                       BUG();
+               else
+                       BUG_ON(vpp_counter < 0);
        }
        spin_unlock_irq(&dnpc_spin);
 }
@@ -240,8 +240,8 @@ static void adnp_set_vpp(struct map_info *not_used, int on)
        {
                if(--vpp_counter == 0)
                        setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8);
-               else if(vpp_counter < 0)
-                       BUG();
+               else
+                       BUG_ON(vpp_counter < 0);
        }
        spin_unlock_irq(&dnpc_spin);
 }
index 7f3ff500b68e37e3d5028bac85e4c22b9312db40..840dd66ce2dc63c84f4daf13240afe50d40b7d72 100644 (file)
@@ -450,8 +450,7 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr)
 
        kfree(tr->blkcore_priv);
 
-       if (!list_empty(&tr->devs))
-               BUG();
+       BUG_ON(!list_empty(&tr->devs));
        return 0;
 }
 
index b1bf8c411de78e6c7685d7cd8928e642dd1afeb5..9af840364a74ff849c2aa283b25c0dc6038565a1 100644 (file)
@@ -477,8 +477,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
        }
 
        /* must never happen since size limit has been verified above */
-       if (i >= concat->num_subdev)
-               BUG();
+       BUG_ON(i >= concat->num_subdev);
 
        /* now do the erase: */
        err = 0;
@@ -500,8 +499,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
                if ((err = concat_dev_erase(subdev, erase))) {
                        /* sanity check: should never happen since
                         * block alignment has been checked above */
-                       if (err == -EINVAL)
-                               BUG();
+                       BUG_ON(err == -EINVAL);
                        if (erase->fail_addr != 0xffffffff)
                                instr->fail_addr = erase->fail_addr + offset;
                        break;