Commit a09431da381ce8d1b4d48e1cbca5f2b4eea662f4
Committed by
Tom Rini
1 parent
9233279f8e
Exists in
v2017.01-smarct4x
and in
40 other branches
mtd: nand: omap_gpmc: minor cleanup of omap_correct_data_bch
This patch tries to avoid some local pointer dereferences, by using common local variables in omap_correct_data_bch() Signed-off-by: Pekon Gupta <pekon@ti.com> Reviewed-by: Stefan Roese <sr@denx.de>
Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff
drivers/mtd/nand/omap_gpmc.c
... | ... | @@ -331,7 +331,7 @@ |
331 | 331 | { |
332 | 332 | struct nand_chip *chip = mtd->priv; |
333 | 333 | struct omap_nand_info *info = chip->priv; |
334 | - uint32_t eccbytes = chip->ecc.bytes; | |
334 | + struct nand_ecc_ctrl *ecc = &chip->ecc; | |
335 | 335 | uint32_t error_count = 0, error_max; |
336 | 336 | uint32_t error_loc[8]; |
337 | 337 | enum bch_level bch_type; |
... | ... | @@ -340,7 +340,7 @@ |
340 | 340 | uint32_t byte_pos, bit_pos; |
341 | 341 | |
342 | 342 | /* check calculated ecc */ |
343 | - for (i = 0; i < chip->ecc.bytes && !ecc_flag; i++) { | |
343 | + for (i = 0; i < ecc->bytes && !ecc_flag; i++) { | |
344 | 344 | if (calc_ecc[i] != 0x00) |
345 | 345 | ecc_flag = 1; |
346 | 346 | } |
... | ... | @@ -349,7 +349,7 @@ |
349 | 349 | |
350 | 350 | /* check for whether its a erased-page */ |
351 | 351 | ecc_flag = 0; |
352 | - for (i = 0; i < chip->ecc.bytes && !ecc_flag; i++) { | |
352 | + for (i = 0; i < ecc->bytes && !ecc_flag; i++) { | |
353 | 353 | if (read_ecc[i] != 0xff) |
354 | 354 | ecc_flag = 1; |
355 | 355 | } |
... | ... | @@ -363,7 +363,7 @@ |
363 | 363 | switch (info->ecc_scheme) { |
364 | 364 | case OMAP_ECC_BCH8_CODE_HW: |
365 | 365 | bch_type = BCH_8_BIT; |
366 | - omap_reverse_list(calc_ecc, eccbytes - 1); | |
366 | + omap_reverse_list(calc_ecc, ecc->bytes - 1); | |
367 | 367 | break; |
368 | 368 | default: |
369 | 369 | return -EINVAL; |
... | ... | @@ -379,7 +379,7 @@ |
379 | 379 | switch (info->ecc_scheme) { |
380 | 380 | case OMAP_ECC_BCH8_CODE_HW: |
381 | 381 | /* 14th byte in ECC is reserved to match ROM layout */ |
382 | - error_max = SECTOR_BYTES + (eccbytes - 1); | |
382 | + error_max = SECTOR_BYTES + (ecc->bytes - 1); | |
383 | 383 | break; |
384 | 384 | default: |
385 | 385 | return -EINVAL; |