Skip to content

Commit

Permalink
mtd: redboot: remove useless code
Browse files Browse the repository at this point in the history
We do not need to invoke 'mtd_can_have_bb()' before invoking
'mtd_block_isbad()' because the latter already handles the case when the MTD
device does not support bad blocks.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Mar 26, 2012
1 parent b256757 commit 050c0c1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/mtd/redboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ static int parse_redboot_partitions(struct mtd_info *master,

if ( directory < 0 ) {
offset = master->size + directory * master->erasesize;
while (mtd_can_have_bb(master) &&
mtd_block_isbad(master, offset)) {
while (mtd_block_isbad(master, offset)) {
if (!offset) {
nogood:
printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
Expand All @@ -89,8 +88,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
}
} else {
offset = directory * master->erasesize;
while (mtd_can_have_bb(master) &&
mtd_block_isbad(master, offset)) {
while (mtd_block_isbad(master, offset)) {
offset += master->erasesize;
if (offset == master->size)
goto nogood;
Expand Down

0 comments on commit 050c0c1

Please sign in to comment.