Unverified Commit 443cde0d authored by Johan Hovold's avatar Johan Hovold Committed by Mark Brown
Browse files

spi: orion: fix clock imbalance on registration failure



Make sure that the controller is not runtime suspended before disabling
clocks on probe failure.

Also restore the autosuspend setting.

Fixes: 5c678694 ("spi: spi-orion: add runtime PM support")
Cc: stable@vger.kernel.org	# 3.17
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260421130211.1537628-3-johan@kernel.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 97b17dd8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -774,6 +774,7 @@ static int orion_spi_probe(struct platform_device *pdev)
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_use_autosuspend(&pdev->dev);
	pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
	pm_runtime_get_noresume(&pdev->dev);
	pm_runtime_enable(&pdev->dev);

	status = orion_spi_reset(spi);
@@ -784,10 +785,15 @@ static int orion_spi_probe(struct platform_device *pdev)
	if (status < 0)
		goto out_rel_pm;

	pm_runtime_put_autosuspend(&pdev->dev);

	return status;

out_rel_pm:
	pm_runtime_disable(&pdev->dev);
	pm_runtime_put_noidle(&pdev->dev);
	pm_runtime_set_suspended(&pdev->dev);
	pm_runtime_dont_use_autosuspend(&pdev->dev);
out_rel_axi_clk:
	clk_disable_unprepare(spi->axi_clk);
out: