Skip to content

Commit ecea4f0

Browse files
jhovoldbroonie
authored andcommitted
spi: cadence: fix clock imbalance on probe failure
Make sure that the controller is active before disabling clocks on probe failure to avoid unbalanced clock disable. Also drop the usage count before returning (so that the controller can be suspended after a probe deferral) and restore the autosuspend setting. Fixes: d36ccd9 ("spi: cadence: Runtime pm adaptation") Cc: stable@vger.kernel.org # 4.7 Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260421123615.1533617-3-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5b1689a commit ecea4f0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/spi/spi-cadence.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,6 @@ static int cdns_spi_probe(struct platform_device *pdev)
741741
/* Set to default valid value */
742742
ctlr->max_speed_hz = xspi->clk_rate / 4;
743743
xspi->speed_hz = ctlr->max_speed_hz;
744-
pm_runtime_put_autosuspend(&pdev->dev);
745744
} else {
746745
ctlr->mode_bits |= SPI_NO_CS;
747746
ctlr->target_abort = cdns_target_abort;
@@ -752,12 +751,17 @@ static int cdns_spi_probe(struct platform_device *pdev)
752751
goto clk_dis_all;
753752
}
754753

754+
if (!spi_controller_is_target(ctlr))
755+
pm_runtime_put_autosuspend(&pdev->dev);
756+
755757
return ret;
756758

757759
clk_dis_all:
758760
if (!spi_controller_is_target(ctlr)) {
759761
pm_runtime_disable(&pdev->dev);
760762
pm_runtime_set_suspended(&pdev->dev);
763+
pm_runtime_put_noidle(&pdev->dev);
764+
pm_runtime_dont_use_autosuspend(&pdev->dev);
761765
}
762766
remove_ctlr:
763767
spi_controller_put(ctlr);

0 commit comments

Comments
 (0)