]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spi: orion: fix clock imbalance on registration failure
authorJohan Hovold <johan@kernel.org>
Tue, 21 Apr 2026 13:02:10 +0000 (15:02 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 22 Apr 2026 12:49:15 +0000 (13:49 +0100)
Make sure that the controller is not runtime suspended before disabling
clocks on probe failure.

Also restore the autosuspend setting.

Fixes: 5c6786945b4e ("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: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260421130211.1537628-3-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-orion.c

index c61ebfd1d18d139db056dc98dff7191662243fa6..a5ce970ff5a8c329a379fbe89ad7f120deae6458 100644 (file)
@@ -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: