summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2017-01-09 11:15:14 +0100
committerTom Rini <trini@konsulko.com>2017-01-14 16:47:18 -0500
commit6fe7fe12ccfe4e3f068e6adb624a3092e7e852c9 (patch)
treea50ad84de07b3af396878d330bf81bc8985cc1dd /drivers/mtd
parent506c66ee9c9a3c2a463285687124c87a7e961a3e (diff)
downloadu-boot-6fe7fe12ccfe4e3f068e6adb624a3092e7e852c9.tar.gz
u-boot-6fe7fe12ccfe4e3f068e6adb624a3092e7e852c9.tar.xz
u-boot-6fe7fe12ccfe4e3f068e6adb624a3092e7e852c9.zip
omap-gpmc: use SECTOR_BYTES instead of hardcoded value
Replace hardcoded value with defined constant SECTOR_BYTES. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/omap_gpmc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index d1e1bdda28..f4f0de395b 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -656,14 +656,14 @@ static int omap_correct_data_bch_sw(struct mtd_info *mtd, u_char *data,
struct nand_chip *chip = mtd_to_nand(mtd);
struct omap_nand_info *info = nand_get_controller_data(chip);
- count = decode_bch(info->control, NULL, 512, read_ecc, calc_ecc,
- NULL, errloc);
+ count = decode_bch(info->control, NULL, SECTOR_BYTES,
+ read_ecc, calc_ecc, NULL, errloc);
if (count > 0) {
/* correct errors */
for (i = 0; i < count; i++) {
/* correct data only, not ecc bytes */
- if (errloc[i] < 8*512)
- data[errloc[i]/8] ^= 1 << (errloc[i] & 7);
+ if (errloc[i] < SECTOR_BYTES << 3)
+ data[errloc[i] >> 3] ^= 1 << (errloc[i] & 7);
debug("corrected bitflip %u\n", errloc[i]);
#ifdef DEBUG
puts("read_ecc: ");