summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-03 13:54:28 +0300
committerBoris Brezillon <boris.brezillon@free-electrons.com>2017-07-03 13:39:09 +0200
commit81667e9c8ad827365f2d1e8b924caf062a19c593 (patch)
tree87f717210124729e347eae8362bebaf720ab9405
parentedfee3619c4955be38d414f25bd4f6c5c1b029ba (diff)
downloadop-kernel-dev-81667e9c8ad827365f2d1e8b924caf062a19c593.zip
op-kernel-dev-81667e9c8ad827365f2d1e8b924caf062a19c593.tar.gz
mtd: nand: mtk: release lock on error path
We only want to hold the lock on the success path, not this error path. Fixes: 7ec4a37c5d71 ("mtd: nand: mediatek: add support for different MTK NAND FLASH Controller IP") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r--drivers/mtd/nand/mtk_ecc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
index f38e2bb..6c3a4aa 100644
--- a/drivers/mtd/nand/mtk_ecc.c
+++ b/drivers/mtd/nand/mtk_ecc.c
@@ -273,8 +273,10 @@ int mtk_ecc_enable(struct mtk_ecc *ecc, struct mtk_ecc_config *config)
mtk_ecc_wait_idle(ecc, op);
ret = mtk_ecc_config(ecc, config);
- if (ret)
+ if (ret) {
+ mutex_unlock(&ecc->lock);
return ret;
+ }
if (config->mode != ECC_NFI_MODE || op != ECC_ENCODE) {
init_completion(&ecc->done);
OpenPOWER on IntegriCloud