Skip to content

Commit 5ff4d5d

Browse files
jhovoldbroonie
authored andcommitted
spi: cadence-quadspi: fix runtime pm disable imbalance on probe failure
A recent attempt to fix the probe error handling introduced a runtime PM disable depth imbalance by incorrectly disabling runtime PM on early failures (e.g. probe deferral). Fixes: f18c8cf ("spi: cadence-qspi: Fix probe error path and remove") Cc: stable@vger.kernel.org # 7.0 Cc: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260421125354.1534871-2-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 922f8c2 commit 5ff4d5d

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

drivers/spi/spi-cadence-quadspi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,7 @@ static int cqspi_probe(struct platform_device *pdev)
18671867
ret = clk_bulk_prepare_enable(CLK_QSPI_NUM, cqspi->clks);
18681868
if (ret) {
18691869
dev_err(dev, "Cannot enable QSPI clocks.\n");
1870-
goto disable_rpm;
1870+
return ret;
18711871
}
18721872

18731873
/* Obtain QSPI reset control */
@@ -1977,7 +1977,7 @@ static int cqspi_probe(struct platform_device *pdev)
19771977
ret = cqspi_request_mmap_dma(cqspi);
19781978
if (ret == -EPROBE_DEFER) {
19791979
dev_err_probe(&pdev->dev, ret, "Failed to request mmap DMA\n");
1980-
goto disable_controller;
1980+
goto disable_rpm;
19811981
}
19821982
}
19831983

@@ -1995,14 +1995,13 @@ static int cqspi_probe(struct platform_device *pdev)
19951995
release_dma_chan:
19961996
if (cqspi->rx_chan)
19971997
dma_release_channel(cqspi->rx_chan);
1998-
disable_controller:
1998+
disable_rpm:
1999+
if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM)))
2000+
pm_runtime_disable(dev);
19992001
cqspi_controller_enable(cqspi, 0);
20002002
disable_clks:
20012003
if (pm_runtime_get_sync(&pdev->dev) >= 0)
20022004
clk_bulk_disable_unprepare(CLK_QSPI_NUM, cqspi->clks);
2003-
disable_rpm:
2004-
if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM)))
2005-
pm_runtime_disable(dev);
20062005

20072006
return ret;
20082007
}

0 commit comments

Comments
 (0)