Skip to content

Commit

Permalink
mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()
Browse files Browse the repository at this point in the history
[ Upstream commit a5a8812 ]

In fsmc_nand_resume(), the return value of clk_prepare_enable() should be
checked since it might fail.

Fixes: e25da1c ("mtd: fsmc_nand: Add clk_{un}prepare() support")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230817115839.10192-1-yiyang13@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yi Yang authored and gregkh committed Sep 13, 2023
1 parent eaf4c78 commit 222b85e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/mtd/nand/raw/fsmc_nand.c
Expand Up @@ -1202,9 +1202,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);
Expand Down

0 comments on commit 222b85e

Please sign in to comment.