diff mbox series

mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()

Message ID 20230817115839.10192-1-yiyang13@huawei.com
State Accepted
Headers show
Series mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume() | expand

Commit Message

Yi Yang Aug. 17, 2023, 11:58 a.m. UTC
In fsmc_nand_resume(), the return value of clk_prepare_enable() should be
checked since it might fail.

Fixes: e25da1c07dfb ("mtd: fsmc_nand: Add clk_{un}prepare() support")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
 drivers/mtd/nand/raw/fsmc_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Miquel Raynal Aug. 18, 2023, 2:41 p.m. UTC | #1
On Thu, 2023-08-17 at 11:58:39 UTC, Yi Yang wrote:
> In fsmc_nand_resume(), the return value of clk_prepare_enable() should be
> checked since it might fail.
> 
> Fixes: e25da1c07dfb ("mtd: fsmc_nand: Add clk_{un}prepare() support")
> Signed-off-by: Yi Yang <yiyang13@huawei.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index 7b4742420dfc..2e33ae77502a 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -1200,9 +1200,14 @@  static int fsmc_nand_suspend(struct device *dev)
 static int fsmc_nand_resume(struct device *dev)
 {
 	struct fsmc_nand_data *host = dev_get_drvdata(dev);
+	int ret;
 
 	if (host) {
-		clk_prepare_enable(host->clk);
+		ret = clk_prepare_enable(host->clk);
+		if (ret) {
+			dev_err(dev, "failed to enable clk\n");
+			return ret;
+		}
 		if (host->dev_timings)
 			fsmc_nand_setup(host, host->dev_timings);
 		nand_reset(&host->nand, 0);