]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: nand: mtk: release lock on error path
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 3 Jul 2017 10:54:28 +0000 (13:54 +0300)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 3 Jul 2017 11:39:09 +0000 (13:39 +0200)
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>
drivers/mtd/nand/mtk_ecc.c

index f38e2bb1953e902818af184204c45b788d71ce38..6c3a4aab0b487114181c000ff4c068d3c17329f8 100644 (file)
@@ -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);