Skip to content

Commit 1527b07

Browse files
jhovoldbroonie
authored andcommitted
spi: zynqmp-gqspi: fix clock imbalance on probe failure
Make sure that the device is not runtime suspended before explicitly disabling the clocks on probe failure and on driver unbind to avoid a clock enable-count imbalance. Fixes: 9e3a000 ("spi: zynqmp: Add pm runtime support") Cc: stable@vger.kernel.org # 4.19 Cc: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com> Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/Message-Id: <20230622082435.7873-1-johan+linaro@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9d7054f commit 1527b07

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/spi/spi-zynqmp-gqspi.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,9 +1342,9 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
13421342
return 0;
13431343

13441344
clk_dis_all:
1345-
pm_runtime_put_sync(&pdev->dev);
1346-
pm_runtime_set_suspended(&pdev->dev);
13471345
pm_runtime_disable(&pdev->dev);
1346+
pm_runtime_put_noidle(&pdev->dev);
1347+
pm_runtime_set_suspended(&pdev->dev);
13481348
clk_disable_unprepare(xqspi->refclk);
13491349
clk_dis_pclk:
13501350
clk_disable_unprepare(xqspi->pclk);
@@ -1368,11 +1368,15 @@ static void zynqmp_qspi_remove(struct platform_device *pdev)
13681368
{
13691369
struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev);
13701370

1371+
pm_runtime_get_sync(&pdev->dev);
1372+
13711373
zynqmp_gqspi_write(xqspi, GQSPI_EN_OFST, 0x0);
1374+
1375+
pm_runtime_disable(&pdev->dev);
1376+
pm_runtime_put_noidle(&pdev->dev);
1377+
pm_runtime_set_suspended(&pdev->dev);
13721378
clk_disable_unprepare(xqspi->refclk);
13731379
clk_disable_unprepare(xqspi->pclk);
1374-
pm_runtime_set_suspended(&pdev->dev);
1375-
pm_runtime_disable(&pdev->dev);
13761380
}
13771381

13781382
MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match);

0 commit comments

Comments
 (0)