diff mbox

[U-Boot,v2,6/7] mtd: nand: omap_gpmc: minor cleanup of omap_correct_data_bch

Message ID 1397201135-28764-7-git-send-email-pekon@ti.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

pekon gupta April 11, 2014, 7:25 a.m. UTC
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>
---
 drivers/mtd/nand/omap_gpmc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Stefan Roese April 11, 2014, 7:36 a.m. UTC | #1
On 11.04.2014 09:25, Pekon Gupta wrote:
> 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>

Thanks,
Stefan
Stefan Roese May 14, 2014, 5:53 a.m. UTC | #2
On 11.04.2014 09:25, Pekon Gupta wrote:
> 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>

Thanks,
Stefan
Tom Rini June 6, 2014, 9:54 p.m. UTC | #3
On Fri, Apr 11, 2014 at 12:55:34PM +0530, pekon gupta wrote:

> 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>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot-ti/master, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index ae8fbb4..b1be8eb 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -331,7 +331,7 @@  static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
 {
 	struct nand_chip *chip = mtd->priv;
 	struct omap_nand_info *info = chip->priv;
-	uint32_t eccbytes = chip->ecc.bytes;
+	struct nand_ecc_ctrl *ecc = &chip->ecc;
 	uint32_t error_count = 0, error_max;
 	uint32_t error_loc[8];
 	enum bch_level bch_type;
@@ -340,7 +340,7 @@  static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
 	uint32_t byte_pos, bit_pos;
 
 	/* check calculated ecc */
-	for (i = 0; i < chip->ecc.bytes && !ecc_flag; i++) {
+	for (i = 0; i < ecc->bytes && !ecc_flag; i++) {
 		if (calc_ecc[i] != 0x00)
 			ecc_flag = 1;
 	}
@@ -349,7 +349,7 @@  static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
 
 	/* check for whether its a erased-page */
 	ecc_flag = 0;
-	for (i = 0; i < chip->ecc.bytes && !ecc_flag; i++) {
+	for (i = 0; i < ecc->bytes && !ecc_flag; i++) {
 		if (read_ecc[i] != 0xff)
 			ecc_flag = 1;
 	}
@@ -363,7 +363,7 @@  static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
 	switch (info->ecc_scheme) {
 	case OMAP_ECC_BCH8_CODE_HW:
 		bch_type = BCH_8_BIT;
-		omap_reverse_list(calc_ecc, eccbytes - 1);
+		omap_reverse_list(calc_ecc, ecc->bytes - 1);
 		break;
 	default:
 		return -EINVAL;
@@ -379,7 +379,7 @@  static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
 		switch (info->ecc_scheme) {
 		case OMAP_ECC_BCH8_CODE_HW:
 			/* 14th byte in ECC is reserved to match ROM layout */
-			error_max = SECTOR_BYTES + (eccbytes - 1);
+			error_max = SECTOR_BYTES + (ecc->bytes - 1);
 			break;
 		default:
 			return -EINVAL;