public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: mtk: release lock on error path
@ 2017-07-03 10:54 Dan Carpenter
  2017-07-04  1:20 ` xiaolei li
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-07-03 10:54 UTC (permalink / raw)
  To: Boris Brezillon, Xiaolei Li
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Cyrille Pitchen, Matthias Brugger, linux-mtd, linux-mediatek,
	kernel-janitors

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>

diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
index f38e2bb1953e..6c3a4aab0b48 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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-04  1:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03 10:54 [PATCH] mtd: nand: mtk: release lock on error path Dan Carpenter
2017-07-04  1:20 ` xiaolei li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox