Commit 373ebfbf authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Adrian Bunk

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: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent 36ddf5bb
...@@ -218,8 +218,8 @@ static void dnp_set_vpp(struct map_info *not_used, int on) ...@@ -218,8 +218,8 @@ static void dnp_set_vpp(struct map_info *not_used, int on)
{ {
if(--vpp_counter == 0) if(--vpp_counter == 0)
setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4); setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4);
else if(vpp_counter < 0) else
BUG(); BUG_ON(vpp_counter < 0);
} }
spin_unlock_irq(&dnpc_spin); spin_unlock_irq(&dnpc_spin);
} }
...@@ -240,8 +240,8 @@ static void adnp_set_vpp(struct map_info *not_used, int on) ...@@ -240,8 +240,8 @@ static void adnp_set_vpp(struct map_info *not_used, int on)
{ {
if(--vpp_counter == 0) if(--vpp_counter == 0)
setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8); setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8);
else if(vpp_counter < 0) else
BUG(); BUG_ON(vpp_counter < 0);
} }
spin_unlock_irq(&dnpc_spin); spin_unlock_irq(&dnpc_spin);
} }
......
...@@ -450,8 +450,7 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) ...@@ -450,8 +450,7 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr)
kfree(tr->blkcore_priv); kfree(tr->blkcore_priv);
if (!list_empty(&tr->devs)) BUG_ON(!list_empty(&tr->devs));
BUG();
return 0; return 0;
} }
......
...@@ -477,8 +477,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -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 */ /* must never happen since size limit has been verified above */
if (i >= concat->num_subdev) BUG_ON(i >= concat->num_subdev);
BUG();
/* now do the erase: */ /* now do the erase: */
err = 0; err = 0;
...@@ -500,8 +499,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -500,8 +499,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
if ((err = concat_dev_erase(subdev, erase))) { if ((err = concat_dev_erase(subdev, erase))) {
/* sanity check: should never happen since /* sanity check: should never happen since
* block alignment has been checked above */ * block alignment has been checked above */
if (err == -EINVAL) BUG_ON(err == -EINVAL);
BUG();
if (erase->fail_addr != 0xffffffff) if (erase->fail_addr != 0xffffffff)
instr->fail_addr = erase->fail_addr + offset; instr->fail_addr = erase->fail_addr + offset;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment