[PATCH 4.19 209/421] mtd: rawnand: marvell: add missing clk_disable_unprepare() on error in marvell_nfc_resume()

From: Greg Kroah-Hartman
Date: Mon Jul 19 2021 - 12:26:53 EST


From: Yang Yingliang <yangyingliang@xxxxxxxxxx>

[ Upstream commit ae94c49527aa9bd3b563349adc4b5617747ca6bd ]

Add clk_disable_unprepare() on error path in marvell_nfc_resume().

Fixes: bd9c3f9b3c00 ("mtd: rawnand: marvell: add suspend and resume hooks")
Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
Link: https://lore.kernel.org/linux-mtd/20210601125814.3260364-1-yangyingliang@xxxxxxxxxx
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/mtd/nand/raw/marvell_nand.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index 00b1adcfad86..07bd41dd4356 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -2880,8 +2880,10 @@ static int __maybe_unused marvell_nfc_resume(struct device *dev)
return ret;

ret = clk_prepare_enable(nfc->reg_clk);
- if (ret < 0)
+ if (ret < 0) {
+ clk_disable_unprepare(nfc->core_clk);
return ret;
+ }

/*
* Reset nfc->selected_chip so the next command will cause the timing
--
2.30.2