Skip to content

Commit

Permalink
BUG_ON() Conversion in drivers/mtd/
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Sesterhenn authored and Adrian Bunk committed Mar 26, 2006
1 parent 36ddf5b commit 373ebfb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
8 changes: 4 additions & 4 deletions drivers/mtd/maps/dilnetpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 2 additions & 4 deletions drivers/mtd/mtdconcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 373ebfb

Please sign in to comment.