]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mtd: check for max_bitflips in mtd_read_oob()
authorBrian Norris <computersforpeace@gmail.com>
Fri, 22 Jun 2012 23:35:39 +0000 (16:35 -0700)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 24 Aug 2012 08:03:35 +0000 (11:03 +0300)
commit76c6ccbca194a6aa4748e057ddb63bdedeba81be
tree0a17dcd289bb253f7b0329be17c1e2b8aaf83c14
parent2f9eca8cdcc83e9df5e6f8fb0731dac4bc27001a
mtd: check for max_bitflips in mtd_read_oob()

mtd_read_oob() has some unexpected similarities to mtd_read(). For
instance, when ops->datbuf != NULL, nand_base.c might return max_bitflips;
however, when ops->datbuf == NULL, nand_base's code potentially could
return -EUCLEAN (no in-tree drivers do this yet). In any case where the
driver might return max_bitflips, we should translate this into an
appropriate return code using the bitflip_threshold.

Essentially, mtd_read_oob() duplicates the logic from mtd_read().

This prevents users of mtd_read_oob() from receiving a positive return
value (i.e., from max_bitflips) and interpreting it as an unknown error.

Artem: amend comments.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Mike Dunn <mikedunn@newsguy.com>
Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/mtdcore.c