summaryrefslogtreecommitdiff
path: root/drivers/spi/atmel-quadspi.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2023-03-17 11:42:30 +0300
committerMark Brown <broonie@kernel.org>2023-03-17 18:47:49 +0300
commitc18bbac353ffed50be134b0a2a059a2bd540c503 (patch)
tree24ce6cf1c9b4baa5f6be7cfa1d3f42adabd3153e /drivers/spi/atmel-quadspi.c
parenteeac8ede17557680855031c6f305ece2378af326 (diff)
downloadlinux-c18bbac353ffed50be134b0a2a059a2bd540c503.tar.xz
spi: atmel-quadspi: Don't leak clk enable count in pm resume
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: 4a2f83b7f780 ("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>
Diffstat (limited to 'drivers/spi/atmel-quadspi.c')
-rw-r--r--drivers/spi/atmel-quadspi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index f4632cb07495..0c6f80ddea57 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -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 = {