[PATCH 1/3] spi: atmel-quadspi: Don't leak clk enable count in pm resume

Tudor Ambarus tudor.ambarus at linaro.org
Fri Mar 17 03:01:09 PDT 2023



On 3/17/23 08:42, Uwe Kleine-König wrote:
> 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 at pengutronix.de>

Reviewed-by: Tudor Ambarus <tudor.ambarus at linaro.org>

> ---
>  drivers/spi/atmel-quadspi.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> 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 = {



More information about the linux-arm-kernel mailing list