Skip to content

Commit

Permalink
spi: atmel-quadspi: Don't leak clk enable count in pm resume
Browse files Browse the repository at this point in the history
[ Upstream commit c18bbac ]

The pm resume call is supposed to enable two clocks. If the second enable
fails the callback reports failure but doesn't undo the first enable.

So call clk_disable() for the first clock when clk_enable() for the second
one fails.

Fixes: 4a2f83b ("spi: atmel-quadspi: add runtime pm support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20230317084232.142257-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Uwe Kleine-König authored and gregkh committed May 11, 2023
1 parent 149b5f0 commit c81e7dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/spi/atmel-quadspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,11 @@ static int __maybe_unused atmel_qspi_runtime_resume(struct device *dev)
if (ret)
return ret;

return clk_enable(aq->qspick);
ret = clk_enable(aq->qspick);
if (ret)
clk_disable(aq->pclk);

return ret;
}

static const struct dev_pm_ops __maybe_unused atmel_qspi_pm_ops = {
Expand Down

0 comments on commit c81e7dd

Please sign in to comment.