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>
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);