diff options
author | Josh Wu <josh.wu@atmel.com> | 2013-08-07 17:58:11 +0800 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2013-08-30 21:34:36 +0100 |
commit | 1fad0e8b9a8889f6ca79be570e06d00785f15aed (patch) | |
tree | d44e7bbc5ba28704feb1b65da9ee7229f0312db4 /drivers/mtd/nand | |
parent | e09f7f992833ed73f1afc5eaa7cc4d5b10b04b7c (diff) | |
download | op-kernel-dev-1fad0e8b9a8889f6ca79be570e06d00785f15aed.zip op-kernel-dev-1fad0e8b9a8889f6ca79be570e06d00785f15aed.tar.gz |
mtd: atmel_nand: move the sanity check to the beginning of pmecc_enable()
It is better to do the sanity check for the parameter before any hardware
operation.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 1ffa52f..0e365da 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -905,15 +905,15 @@ static void pmecc_enable(struct atmel_nand_host *host, int ecc_op) { u32 val; - pmecc_writel(host->ecc, CTRL, PMECC_CTRL_RST); - pmecc_writel(host->ecc, CTRL, PMECC_CTRL_DISABLE); - val = pmecc_readl_relaxed(host->ecc, CFG); - if (ecc_op != NAND_ECC_READ && ecc_op != NAND_ECC_WRITE) { dev_err(host->dev, "atmel_nand: wrong pmecc operation type!"); return; } + pmecc_writel(host->ecc, CTRL, PMECC_CTRL_RST); + pmecc_writel(host->ecc, CTRL, PMECC_CTRL_DISABLE); + val = pmecc_readl_relaxed(host->ecc, CFG); + if (ecc_op == NAND_ECC_READ) pmecc_writel(host->ecc, CFG, (val & ~PMECC_CFG_WRITE_OP) | PMECC_CFG_AUTO_ENABLE); |